| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 6 | public static function createWriter($element) |
|
| 30 | { |
||
| 31 | 6 | if ($element instanceof WriterInterface) { |
|
| 32 | 1 | $writer = $element; |
|
| 33 | 6 | } elseif (isset($element['writer']) && $element['writer'] instanceof WriterInterface) { |
|
| 34 | 3 | $writer = $element['writer']; |
|
| 35 | 3 | } else { |
|
| 36 | 2 | throw new InvalidArgumentException('Workflow::addWriter() must be called with either an instance of '. |
|
| 37 | 2 | '"Plum\Plum\Writer\WriterInterface" or with an array that contains '. |
|
| 38 | 2 | '"writer".'); |
|
| 39 | } |
||
| 40 | |||
| 41 | 4 | $pipe = new self($element); |
|
| 42 | 4 | $pipe->writer = $writer; |
|
| 43 | |||
| 44 | 4 | return $pipe; |
|
| 45 | } |
||
| 46 | } |
||
| 47 |