| Conditions | 3 |
| Paths | 3 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 17 | public function __construct($fqsen) |
|
| 39 | { |
||
| 40 | 17 | $matches = []; |
|
| 41 | 17 | $result = preg_match( |
|
| 42 | 17 | '/^\\\\([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\\\]*)?(?:[:]{2}\\$?([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*))?(?:\\(\\))?$/', |
|
| 43 | 17 | $fqsen, |
|
| 44 | 17 | $matches |
|
| 45 | ); |
||
| 46 | |||
| 47 | 17 | if ($result === 0) { |
|
| 48 | 4 | throw new \InvalidArgumentException( |
|
| 49 | 4 | sprintf('"%s" is not a valid Fqsen.', $fqsen) |
|
| 50 | ); |
||
| 51 | } |
||
| 52 | |||
| 53 | 13 | $this->fqsen = $fqsen; |
|
| 54 | |||
| 55 | 13 | if (isset($matches[2])) { |
|
| 56 | 3 | $this->name = $matches[2]; |
|
| 57 | } else { |
||
| 58 | 10 | $matches = explode('\\', $fqsen); |
|
| 59 | 10 | $this->name = trim(end($matches), '()'); |
|
| 60 | } |
||
| 61 | 13 | } |
|
| 62 | |||
| 83 |