| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | 6 | public function transform($input, array $arguments) |
|
| 38 | { |
||
| 39 | // I should have two arguments: old format / new format |
||
| 40 | 6 | if (count($arguments) !== 1) { |
|
| 41 | 2 | throw new TransformationException('Rule Implode Expects exactly 1 argument'); |
|
| 42 | } |
||
| 43 | |||
| 44 | 4 | if (!is_array($input)) { |
|
| 45 | 1 | throw new NotTransformableException('Rule Implode can transform an array. ' |
|
| 46 | 1 | . gettype($input).' found in input'); |
|
| 47 | } |
||
| 48 | |||
| 49 | // Transform it |
||
| 50 | 3 | $output = implode($arguments[0], $input); |
|
| 51 | |||
| 52 | 3 | return $output; |
|
| 53 | } |
||
| 54 | } |
||
| 55 |