Rule
class Rule implements RuleInterface, ConfigurableRuleInterface (View source)
A single rule for the web server.
Properties
protected string|callable | $code | The code of the rule. |
|
protected bool|callable | $enabled | Is this rule enabled (should be present in the configuration) or disabled (should not be present in the configuration)? |
|
protected string | $commentsBefore | Optional comments to be placed before the rule itself. |
|
protected string | $commentsAfter | Optional comments to be placed after the rule itself. |
|
protected Option[] | $options | The rule options. |
Methods
Intializes the instance.
Return the code of the rule.
Is this rule enabled (should be present in the configuration) or disabled (should not be present in the configuration)?
Return optional comments to be placed before the rule itself.
Return optional comments to be placed after the rule itself.
Get all the rule options.
Details
__construct(string|callable $code, bool|callable $enabled, string $commentsBefore = '', string $commentsAfter = '')
Intializes the instance.
string
getCode()
Return the code of the rule.
isEnabled()
Is this rule enabled (should be present in the configuration) or disabled (should not be present in the configuration)?
string
getCommentsBefore()
Return optional comments to be placed before the rule itself.
string
getCommentsAfter()
Return optional comments to be placed after the rule itself.
addOption(string $handle, Option $option)
Add an option to this rule.
Option[]
getOptions()
Get all the rule options.
Option|null
getOption(string $handle)
Get an option given its handle.