| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public static function make($args) |
||
| 11 | { |
||
| 12 | $args = func_get_args($args); |
||
| 13 | $renderable = $args[0]; |
||
| 14 | unset($args[0]); |
||
| 15 | |||
| 16 | $class = __NAMESPACE__ . '\Renderables\\' . $renderable; |
||
| 17 | |||
| 18 | if (class_exists($class)) { |
||
| 19 | $obj = new $class; |
||
| 20 | if ($obj instanceof RenderableInterface) { |
||
| 21 | return $obj->render(array_values($args)); |
||
| 22 | } else { |
||
| 23 | throw new \Exception( |
||
| 24 | "class {$class} must implement \Slim\Interfaces\RenderableInterface interface" |
||
| 25 | ); |
||
| 26 | } |
||
| 27 | } else { |
||
| 28 | throw new \Exception( |
||
| 29 | "class {$class} not found" |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | } |