| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | public function generateImage(ParserResult $parserResult) |
||
| 43 | { |
||
| 44 | $path = $parserResult->getFilePath(); |
||
| 45 | |||
| 46 | $contents = $this->filesystem->read($path); |
||
| 47 | if (false === $contents) { |
||
| 48 | return false; |
||
| 49 | } |
||
| 50 | |||
| 51 | $transformers = $parserResult->getTransformers(); |
||
| 52 | |||
| 53 | foreach ($transformers as $item) { |
||
| 54 | $transformer = $this->transformersManager->get($item['type']); |
||
| 55 | if (!empty($item['defaults']) && is_array($item['defaults'])) { |
||
| 56 | $transformer->setDefaults($item['defaults']); |
||
| 57 | } |
||
| 58 | $contents = $transformer->apply($contents, $item['options']); |
||
| 59 | } |
||
| 60 | |||
| 61 | return $contents; |
||
| 62 | } |
||
| 63 | } |
||
| 64 |