A feature model for a software product line.

A feature model is a tree describing features and their relationships. Here, it is represented as a list of features and feature constraints (\FeaturePhp\Model\Feature and \FeaturePhp\Model\ConstraintSolver). The underlying XML feature model has its own class, \FeaturePhp\Model\XmlModel.

package Default

 Methods

Creates a feature model.

__construct(\FeaturePhp\Model\XmlModel $xmlModel) 

Parameters

$xmlModel

\FeaturePhp\Model\XmlModel

Adds a feature from an XML node.

addFeature(\SimpleXMLElement $node, \SimpleXMLElement $parent) 

This is expected to be called only from the model's constructor through XmlModel::traverse().

Parameters

$node

\SimpleXMLElement

$parent

\SimpleXMLElement

Returns the feature model's constraint solver.

getConstraintSolver() : \FeaturePhp\Model\ConstraintSolver

Returns

\FeaturePhp\Model\ConstraintSolver

Returns a feature in the feature model with a given name.

getFeature(string $featureName, boolean $permissive = false) : \FeaturePhp\Model\Feature

Parameters

$featureName

string

$permissive

boolean

Returns

\FeaturePhp\Model\Feature

Returns the feature model's list of features.

getFeatures() : array<mixed,\FeaturePhp\Model\Feature>

Returns

array<mixed,\FeaturePhp\Model\Feature>

Returns the feature model's root feature.

getRootFeature() : \FeaturePhp\Model\Feature

Returns

\FeaturePhp\Model\Feature

Returns the feature model's underlying XML feature model.

getXmlModel() : \FeaturePhp\Model\XmlModel

Returns

\FeaturePhp\Model\XmlModel

 Properties

 

a solver containing all feature constraints

$constraintSolver : \FeaturePhp\Model\ConstraintSolver

Default

 

a flat list of all features in the model

$features : array<mixed,\FeaturePhp\Model\Feature>

Default

 

the root of the feature model tree

$rootFeature : \FeaturePhp\Model\Feature

Default

 

the underlying XML feature model

$xmlModel : \FeaturePhp\Model\XmlModel

Default