| Total Complexity | 7 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class ClassHelper |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param $class |
||
| 14 | * @return string[] |
||
| 15 | */ |
||
| 16 | public static function getMethods($class) |
||
| 17 | { |
||
| 18 | $path = \Yii::getAlias('@' . str_replace('\\', '/', ltrim($class, '\\'))) . '.php'; |
||
| 19 | $content = file_get_contents($path); |
||
| 20 | preg_match_all('#^[\s\w]+function\s+(.+)\s*\(#im', $content, $match); |
||
| 21 | return ArrayHelper::getValue($match, 1, []); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param $interface |
||
| 26 | * @return string[] |
||
| 27 | */ |
||
| 28 | public static function getInterfaceMethods($interface) |
||
| 29 | { |
||
| 30 | $interface = new \ReflectionClass($interface); |
||
| 31 | $result = []; |
||
| 32 | foreach ($interface->getMethods(\ReflectionMethod::IS_ABSTRACT) as $method) { |
||
| 33 | if (StringHelper::startsWith($method->class, 'carono\exchange1c\interfaces')) { |
||
| 34 | $result[] = $method; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | return array_values(ArrayHelper::map($result, 'name', 'name')); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param $class |
||
| 42 | * @param $interface |
||
| 43 | * @return boolean[] |
||
| 44 | */ |
||
| 45 | public static function getImplementedMethods($class, $interface) |
||
| 54 | } |
||
| 55 | } |