| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 3 | public static function fromNonExistingClass(string $className) : self |
|
| 18 | { |
||
| 19 | 3 | if (interface_exists($className)) { |
|
| 20 | 1 | return new self(sprintf('The provided type "%s" is an interface, and can not be instantiated', $className)); |
|
| 21 | } |
||
| 22 | |||
| 23 | 2 | if (PHP_VERSION_ID >= 50400 && trait_exists($className)) { |
|
| 24 | 1 | return new self(sprintf('The provided type "%s" is a trait, and can not be instantiated', $className)); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | return new self(sprintf('The provided class "%s" does not exist', $className)); |
|
| 28 | } |
||
| 29 | |||
| 38 |