| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace norsys\score\php\string\regex; |
||
| 17 | function __construct(string $regex) |
||
| 18 | { |
||
| 19 | $previousErrorHandler = set_error_handler(function() {}); |
||
| 20 | |||
| 21 | ( |
||
| 22 | new test\isFalse\strictly |
||
| 23 | ) |
||
| 24 | ->recipientOfTestOnVariableIs( |
||
| 25 | preg_match($regex, ''), |
||
| 26 | new ifTrue\exception(new\invalidArgumentException('Syntax error in regular expression')) |
||
| 27 | ) |
||
| 28 | ; |
||
| 29 | |||
| 30 | set_error_handler($previousErrorHandler); |
||
| 31 | |||
| 32 | $this->regex = $regex; |
||
| 33 | } |
||
| 40 |
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.