A configuration represented in XML.

The XML syntax of FeatureIDE configurations is used. A short valid configuration (for the example model at \FeaturePhp\Model\XmlModel) might look like this:

<configuration>
  <feature automatic="selected" manual="undefined" name="root feature"/>
</configuration>

It is recommended to generate a configuration using FeatureIDE's graphical configuration editor.

package Default

 Methods

Creates an XML configuration.

__construct(\FeaturePhp\Helper\XmlParser $xmlParser) 

Parameters

$xmlParser

\FeaturePhp\Helper\XmlParser

Creates an empty XML configuration.

emptyInstance() : \FeaturePhp\Model\XmlConfiguration
Static

Returns

\FeaturePhp\Model\XmlConfiguration

Creates an XML configuration from an XML file.

fromFile(string $fileName) : \FeaturePhp\Model\XmlConfiguration
Static

Parameters

$fileName

string

Returns

\FeaturePhp\Model\XmlConfiguration

Creates an XML configuration from a request variable.

fromRequest(string $key, boolean $allowEmpty = false) : \FeaturePhp\Model\XmlConfiguration
Static

For simple usage, the configuration can be read from GET, POST or cookie. A note on security: This function is safe to use in production scenarios (assuming the safety of the SimpleXML parser) because a configuration is always validated against the feature model.

Parameters

$key

string

the variable in the request

$allowEmpty

boolean

whether to throw an exception when no configuration is present

Returns

\FeaturePhp\Model\XmlConfiguration

Creates an XML configuration from an XML string.

fromString(string $str, string $directory = null) : \FeaturePhp\Model\XmlConfiguration
Static

Parameters

$str

string

$directory

string

ignored

Returns

\FeaturePhp\Model\XmlConfiguration

Returns the XML configuration's selected feature names.

getSelectedFeatureNames() : array<mixed,string>

Returns

array<mixed,string>

Returns the XML configuration's values.

getValues() : array<mixed,string>

Returns

array<mixed,string>

Returns the XML configuration's underlying XML document.

getXml() : \SimpleXMLElement

Returns

\SimpleXMLElement

Returns the XML configuration's underlying XML parser.

getXmlParser() : \FeaturePhp\Helper\XmlParser

Returns

\FeaturePhp\Helper\XmlParser

 Properties

 

the names of all selected features in the configuration

$selectedFeatureNames : array<mixed,string>

Default

 

names of value features associated with their values

$values : array<mixed,string>

Default

 

the underlying XML document

$xml : \SimpleXMLElement

Default

 

the underlying XML parser

$xmlParser : \FeaturePhp\Helper\XmlParser

Default