本文整理汇总了PHP中Requirement::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirement::__construct方法的具体用法?PHP Requirement::__construct怎么用?PHP Requirement::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requirement
的用法示例。
在下文中一共展示了Requirement::__construct方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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];
}
示例2: __construct
/**
* Constructor that initializes the requirement.
*
* @param string $cfgName The configuration name used for ini_get()
* @param Boolean|callback $evaluation 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
* @param Boolean $approveCfgAbsence 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.
* @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
* @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
* @param Boolean $optional Whether this is only an optional recommendation not a mandatory requirement
*/
public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
{
$cfgValue = ini_get($cfgName);
if (is_callable($evaluation)) {
if (null === $testMessage || null === $helpHtml) {
throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
}
$fulfilled = call_user_func($evaluation, $cfgValue);
} else {
if (null === $testMessage) {
$testMessage = sprintf('%s %s be %s in php.ini', $cfgName, $optional ? 'should' : 'must', $evaluation ? 'enabled' : 'disabled');
}
if (null === $helpHtml) {
$helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.', $cfgName, $evaluation ? 'on' : 'off');
}
$fulfilled = $evaluation == $cfgValue;
}
parent::__construct($fulfilled || $approveCfgAbsence && false === $cfgValue, $testMessage, $helpHtml, $helpText, $optional);
}
示例3: __construct
/**
* @return PhpVersionRequirement
*/
public function __construct()
{
parent::__construct(Craft::t('iconv support'), null, false, '<a href="http://buildwithcraft.com">Craft</a>');
}
示例4: __construct
/**
* @return WebRootExposedFolderRequirement
*/
public function __construct()
{
parent::__construct(Craft::t('Sensitive Craft folders should not be publicly accessible'), null, false, '<a href="http://craftcms.com">Craft CMS</a>');
}
示例5: __construct
/**
* @return PhpVersionRequirement
*/
public function __construct()
{
parent::__construct(Craft::t('PHP Version'), null, true, '<a href="http://buildwithcraft.com">Craft</a>');
}
示例6: __construct
/**
* @return IconvRequirement
*/
public function __construct()
{
parent::__construct(Craft::t('iconv support'), null, false, '<a href="http://craftcms.com">Craft CMS</a>');
}