A role defines a class' responsibilities in a collaboration.

As part of a \FeaturePhp\Collaboration\Collaboration, a role implements part of a feature's functionality. A role may be the base code for a class or a class refinement. Roles are composed using a \FeaturePhp\Collaboration\Composer.

package Default

 Methods

Creates a role.

__construct(\FeaturePhp\Specification\FileSpecification $fileSpecification, \FeaturePhp\Collaboration\Collaboration $collaboration) 

Parameters

$fileSpecification

\FeaturePhp\Specification\FileSpecification

$collaboration

\FeaturePhp\Collaboration\Collaboration

Returns whether two roles are refining the same class.

correspondsTo(\FeaturePhp\Collaboration\Role $role) : boolean

It requires the roles' files to reside in the same containment hierarchies (i.e. their source paths match). This is an equivalence relation and can be used by \FeaturePhp\Helper\Partition.

Parameters

$role

\FeaturePhp\Collaboration\Role

Returns

boolean

Returns which collaboration the role belongs to.

getCollaboration() : \FeaturePhp\Collaboration\Collaboration

Returns

\FeaturePhp\Collaboration\Collaboration

Returns which file the role refers to.

getFileSpecification() : \FeaturePhp\Specification\FileSpecification

Returns

\FeaturePhp\Specification\FileSpecification

Returns the kind of the role.

getKind() : string

This is used to determine the role's \Composer. As of now, the kind is simply the file extension.

Returns

string

 Properties

 

which collaboration the role belongs to

$collaboration : \FeaturePhp\Collaboration\Collaboration

Default

 

which file the role refers to

$fileSpecification : \FeaturePhp\Specification\FileSpecification

Default