Requirement::__construct PHP Method

__construct() public method

Constructor that initializes the requirement.
public __construct ( boolean $fulfilled, string $testMessage, string $helpHtml, string | null $helpText = null, boolean $optional = false )
$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)
$optional boolean Whether this is only an optional recommendation not a mandatory requirement
    public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
    {
        $this->fulfilled = (bool) $fulfilled;
        $this->testMessage = (string) $testMessage;
        $this->helpHtml = (string) $helpHtml;
        $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
        $this->optional = (bool) $optional;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Constructor that initializes the requirement.
  *
  * @param bool           $fulfilled   Whether the requirement is fulfilled
  * @param string         $testMessage The message for testing the requirement
  * @param string         $helpHtml    The help text formatted in HTML for resolving the problem
  * @param string|null    $helpText    The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
  * @param bool           $optional    Whether this is only an optional recommendation not a mandatory requirement
  * @param array<boolean> $types       Three booleans (informative, dependant, fromApp)
  */
 public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false, $types = [self::INFORMATIVE, self::DEPENDANT, self::FROM_APP])
 {
     parent::__construct($fulfilled, $testMessage, $helpHtml, $helpText, $optional);
     $this->informative = (bool) $types[0];
     $this->dependant = (bool) $types[1];
     $this->fromApp = (bool) $types[2];
 }
All Usage Examples Of Requirement::__construct