Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
CRAP | |
80.00% |
4 / 5 |
| ClassUtil | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
3.07 | |
80.00% |
4 / 5 |
| exists | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| implementsInterface | |
0.00% |
0 / 1 |
2.06 | |
75.00% |
3 / 4 |
|||
| <?php | |
| namespace Siesta\Util; | |
| class ClassUtil | |
| { | |
| /** | |
| * @param string $className | |
| * | |
| * @return bool | |
| */ | |
| public static function exists(string $className) : bool | |
| { | |
| return class_exists($className); | |
| } | |
| /** | |
| * @param string $className | |
| * @param string $interfaceName | |
| * | |
| * @return bool | |
| */ | |
| public static function implementsInterface(string $className, string $interfaceName) : bool | |
| { | |
| if (!self::exists($className)) { | |
| return false; | |
| } | |
| $reflectClass = new \ReflectionClass($className); | |
| return $reflectClass->implementsInterface($interfaceName); | |
| } | |
| } |