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