Settings for an artifact.
The \FeaturePhp\Artifact\Artifact settings follow the structure:
or, alternatively:
If no generator is specified, the empty generator is added automatically. mixed* means that a string, object or bool can be given according to \FeaturePhp\Settings::getInstance().
package | Default |
---|---|
inherited_from | \FeaturePhp\Settings |
__construct(array $cfg, string $directory = "."
)
The directory may be used to resolve relative paths in the settings.
inherited_from | \FeaturePhp\Settings::__construct() |
---|
array
a plain settings array
string
the directory the settings apply to
__construct(array $cfg, string $directory = "."
)
The directory may be used to resolve relative paths in the settings.
array
a plain settings array
string
the directory the settings apply to
fromArray(array $cfg, string $directory = "."
)
array
a plain settings array
string
the directory the settings apply to
fromFile(string $fileName) : \FeaturePhp\Settings
string
\FeaturePhp\Settings
fromString(string $json, string $directory = "."
) : \FeaturePhp\Settings
string
string
the directory the settings apply to
\FeaturePhp\Settings
get() : mixed
A setting path can be supplied variadically.
mixed
getDirectory() : string
string
getIn(array $cfg) : mixed
A setting path can be supplied variadically.
array
mixed
getInstance(string|array|boolean $object, string $klass) : \FeaturePhp\$class
If a string is given, the class is instantiated from a file. If an array("data" => ...) is given, the class is instantiated from a string. If another array is given, the class is instantiated from that array. If true is given, the class is instantiated from an empty array.
string
array
boolean
string
\FeaturePhp\$class
getOptional(mixed $defaultValue) : mixed
A setting path can be supplied variadically.
mixed
mixed
getPath(string $path) : string
string
string
getWith(string $key, callable $predicate) : mixed
Throws \FeaturePhp\InvalidSettingsException if the predicate fails.
string
callable
mixed
inDirectory(string $directory)
string
the directory the settings apply to
has(string $key, array $cfg = null
) : boolean
If no settings array is given, the internal settings array is assumed.
string
array
boolean
set(string $key, mixed $value)
A setting path can be supplied variadically.
string
mixed
setOptional(string $key, mixed $value)
string
mixed
_get(array $cfg) : mixed
A setting path can be supplied variadically.
array
mixed
_set(array $cfg, array $args)
array
array
a setting path followed by the setting's new value
$cfg : array