| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | public function __invoke(array $args) |
||
| 8 | { |
||
| 9 | $this->args = $args; |
||
| 10 | |||
| 11 | if (!isset($this->args['class']) || empty($this->args['class'])) { |
||
| 12 | throw new \OutOfBoundsException('You should define key class to create a log processor'); |
||
| 13 | } |
||
| 14 | |||
| 15 | $class = new \ReflectionClass($args['class']); |
||
| 16 | $params = []; |
||
| 17 | |||
| 18 | if ($constructor = $class->getConstructor()) { |
||
| 19 | $params = $this->getParams($constructor); |
||
| 20 | } |
||
| 21 | |||
| 22 | return $class->newInstanceArgs($params); |
||
| 23 | } |
||
| 24 | } |
||
| 25 |