| 1 | <?php |
||
| 18 | class Validator { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Critical |
||
| 22 | */ |
||
| 23 | const CRITICAL = 'critical'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Warning |
||
| 27 | */ |
||
| 28 | const WARNING = 'warning'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Good |
||
| 32 | */ |
||
| 33 | const GOOD = 'good'; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * unknown |
||
| 37 | */ |
||
| 38 | const UNKNOWN = 'unknown'; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var RuleSet |
||
| 42 | */ |
||
| 43 | private $ruleSet; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Constructor |
||
| 47 | * |
||
| 48 | * @param RuleSet $ruleSet |
||
| 49 | */ |
||
| 50 | function __construct(RuleSet $ruleSet) |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Validate score |
||
| 57 | * |
||
| 58 | * @param $key |
||
| 59 | * @param $value |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function validate($key, $value) { |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Get used ruleset |
||
| 94 | * |
||
| 95 | * @return RuleSet |
||
| 96 | */ |
||
| 97 | public function getRuleSet() { |
||
| 100 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.