| Total Complexity | 4 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 28 | class Validator_PluginName implements Validator_Base { |
||
| 29 | |||
| 30 | protected static $instance = null; |
||
| 31 | |||
| 32 | public function isValide($value): bool { |
||
| 33 | return $value === $this->validate($value); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function validate($value) { |
||
| 37 | //remove all characters except except a-z, A-Z and 0-9 |
||
| 38 | return preg_replace("/[^a-zA-Z_\-0-9]+/", "", $value); |
||
| 39 | } |
||
| 40 | |||
| 41 | public static function getInstance () : Validator_PluginName { |
||
| 47 | } |
||
| 48 | |||
| 49 | } |
||
| 52 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.