Conditions | 3 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.0261 |
Changes | 0 |
1 | <?php |
||
12 | 14 | public function normalizeTemplateName($widget) |
|
13 | { |
||
14 | // class name without namespace. |
||
15 | 14 | $className = str_replace('App\\Widgets\\', '', get_class($widget)); |
|
16 | |||
17 | // replace slashes with dots |
||
18 | 14 | $className = str_replace(['\\', '/'], '.', $className); |
|
19 | |||
20 | 14 | if (! property_exists($widget, 'template')) { |
|
21 | 1 | $widget->template = 'Widgets::'.$className.'View'; |
|
22 | } |
||
23 | |||
24 | 14 | if (! view()->exists($widget->template)) { |
|
25 | throw new \InvalidArgumentException("View file \"{$widget->template}\" not found by: '".get_class($widget)." '"); |
||
26 | } |
||
29 |