| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 13 | public function __construct(string $name) |
|
| 25 | { |
||
| 26 | 13 | if ($name === '') { |
|
| 27 | 1 | throw new InvalidArgumentException( |
|
| 28 | 1 | 'Invalid ClassMethodReference, empty string given. Format must be ClassName::methodName.' |
|
| 29 | ); |
||
| 30 | } |
||
| 31 | |||
| 32 | 12 | $this->name = $name; |
|
| 33 | |||
| 34 | 12 | $e = explode('::', $this->name); |
|
| 35 | |||
| 36 | 12 | if (count($e) < 2) { |
|
| 37 | 1 | throw new InvalidArgumentException( |
|
| 38 | 1 | sprintf('Invalid ClassMethodReference, "%s" given. Format must be ClassName::methodName.', $name) |
|
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | 11 | [$this->className, $this->methodName] = $e; |
|
| 43 | |||
| 44 | 11 | $this->methodName = trim($this->methodName); |
|
| 45 | |||
| 46 | 11 | if ($this->methodName === '') { |
|
| 47 | 2 | throw new InvalidArgumentException( |
|
| 48 | 2 | sprintf('You must specify a method name to find. "%s" given.', $name) |
|
| 49 | ); |
||
| 68 |