Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function create($type) |
||
27 | { |
||
28 | $className = ucfirst($type); |
||
29 | $namespace = "\\Halfpastfour\\PHPChartJS\\Chart"; |
||
30 | $path = "{$namespace}\\{$className}"; |
||
31 | if (! class_exists($path)) { |
||
32 | throw new \InvalidArgumentException("Invalid chart type. {$path} does not exist."); |
||
33 | } |
||
34 | |||
35 | return new $path; |
||
36 | } |
||
38 |