| Conditions | 2 |
| Paths | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | public static function factory(string $name, string $xml) |
||
| 8 | { |
||
| 9 | try { |
||
| 10 | $className = sprintf( |
||
| 11 | '%s\%s', |
||
| 12 | __NAMESPACE__, |
||
| 13 | ucfirst(strtolower($name)) |
||
| 14 | ); |
||
| 15 | $reflectionClass = new \ReflectionClass($className); |
||
| 16 | return $reflectionClass->newInstanceArgs([$xml]); |
||
| 17 | } catch (\ReflectionException $ex) { |
||
| 18 | throw new InvalidEntityException( |
||
| 19 | sprintf('The %s entity does not exist.', $name) |
||
| 20 | ); |
||
| 24 |