Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class Architect |
||
9 | { |
||
10 | /** |
||
11 | * Finds first module which uses a model. |
||
12 | * |
||
13 | * @param string|Model $model |
||
14 | * |
||
15 | * @return mixed |
||
16 | */ |
||
17 | public static function resourceByEntity($model) |
||
18 | { |
||
19 | return app('scaffold.modules')->first(function ($module) use ($model) { |
||
|
|||
20 | if (is_string($model)) { |
||
21 | return get_class($module->model()) === $model; |
||
22 | } |
||
23 | |||
24 | return get_class($module->model()) === get_class($model); |
||
25 | }); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Humanize the given value into a proper name. |
||
30 | * |
||
31 | * @param string $value |
||
32 | * @return string |
||
33 | */ |
||
34 | public static function humanize($value) |
||
41 | } |
||
42 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.