PHP Class RequirementCollection

Inheritance: implements IteratorAggregate
Show file Open project: pagekit/pagekit Class Usage Examples

Public Methods

Method Description
add ( Requirement $requirement ) Adds a Requirement.
addCollection ( RequirementCollection $collection ) Adds a requirement collection to the current set of requirements.
addPhpIniRecommendation ( string $cfgName, boolean | callback $evaluation, boolean $approveCfgAbsence = false, string $testMessage = null, string $helpHtml = null, string | null $helpText = null ) Adds an optional recommendation in form of a php.ini configuration.
addPhpIniRequirement ( string $cfgName, boolean | callback $evaluation, boolean $approveCfgAbsence = false, string $testMessage = null, string $helpHtml = null, string | null $helpText = null ) Adds a mandatory requirement in form of a php.ini configuration.
addRecommendation ( boolean $fulfilled, string $testMessage, string $helpHtml, string | null $helpText = null ) Adds an optional recommendation.
addRequirement ( boolean $fulfilled, string $testMessage, string $helpHtml, string | null $helpText = null ) Adds a mandatory requirement.
all ( ) : array Returns both requirements and recommendations.
getFailedRecommendations ( ) : array Returns the recommendations that were not met.
getFailedRequirements ( ) : array Returns the mandatory requirements that were not met.
getIterator ( ) : Traversable Gets the current RequirementCollection as an Iterator.
getPhpIniConfigPath ( ) : string | false Returns the PHP configuration file (php.ini) path.
getRecommendations ( ) : array Returns all optional recommmendations.
getRequirements ( ) : array Returns all mandatory requirements.
hasPhpIniConfigIssue ( ) : boolean Returns whether a php.ini configuration is not correct.

Method Details

add() public method

Adds a Requirement.
public add ( Requirement $requirement )
$requirement Requirement A Requirement instance

addCollection() public method

Adds a requirement collection to the current set of requirements.
public addCollection ( RequirementCollection $collection )
$collection RequirementCollection A RequirementCollection instance

addPhpIniRecommendation() public method

Adds an optional recommendation in form of a php.ini configuration.
public addPhpIniRecommendation ( string $cfgName, boolean | callback $evaluation, boolean $approveCfgAbsence = false, string $testMessage = null, string $helpHtml = null, string | null $helpText = null )
$cfgName string The configuration name used for ini_get()
$evaluation boolean | callback Either a Boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
$approveCfgAbsence boolean If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
$testMessage string The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
$helpHtml string The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
$helpText string | null The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)

addPhpIniRequirement() public method

Adds a mandatory requirement in form of a php.ini configuration.
public addPhpIniRequirement ( string $cfgName, boolean | callback $evaluation, boolean $approveCfgAbsence = false, string $testMessage = null, string $helpHtml = null, string | null $helpText = null )
$cfgName string The configuration name used for ini_get()
$evaluation boolean | callback Either a Boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
$approveCfgAbsence boolean If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
$testMessage string The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
$helpHtml string The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
$helpText string | null The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)

addRecommendation() public method

Adds an optional recommendation.
public addRecommendation ( boolean $fulfilled, string $testMessage, string $helpHtml, string | null $helpText = null )
$fulfilled boolean Whether the recommendation is fulfilled
$testMessage string The message for testing the recommendation
$helpHtml string The help text formatted in HTML for resolving the problem
$helpText string | null The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)

addRequirement() public method

Adds a mandatory requirement.
public addRequirement ( boolean $fulfilled, string $testMessage, string $helpHtml, string | null $helpText = null )
$fulfilled boolean Whether the requirement is fulfilled
$testMessage string The message for testing the requirement
$helpHtml string The help text formatted in HTML for resolving the problem
$helpText string | null The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)

all() public method

Returns both requirements and recommendations.
public all ( ) : array
return array Array of Requirement instances

getFailedRecommendations() public method

Returns the recommendations that were not met.
public getFailedRecommendations ( ) : array
return array Array of Requirement instances

getFailedRequirements() public method

Returns the mandatory requirements that were not met.
public getFailedRequirements ( ) : array
return array Array of Requirement instances

getIterator() public method

Gets the current RequirementCollection as an Iterator.
public getIterator ( ) : Traversable
return Traversable A Traversable interface

getPhpIniConfigPath() public method

Returns the PHP configuration file (php.ini) path.
public getPhpIniConfigPath ( ) : string | false
return string | false php.ini file path

getRecommendations() public method

Returns all optional recommmendations.
public getRecommendations ( ) : array
return array Array of Requirement instances

getRequirements() public method

Returns all mandatory requirements.
public getRequirements ( ) : array
return array Array of Requirement instances

hasPhpIniConfigIssue() public method

Returns whether a php.ini configuration is not correct.
public hasPhpIniConfigIssue ( ) : boolean
return boolean php.ini configuration problem?