| Conditions | 6 |
| Paths | 10 |
| Total Lines | 48 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 30 |
| CRAP Score | 6.027 |
| Changes | 4 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 15 | 16 | public function getResult(): array |
|
| 16 | { |
||
| 17 | 16 | $result = []; |
|
| 18 | |||
| 19 | 16 | foreach ($this->assets as $asset) { |
|
| 20 | 14 | if (false === $path = $asset->getPath()) { |
|
| 21 | continue; |
||
| 22 | } |
||
| 23 | |||
| 24 | 14 | if ($asset->isUrl()) { |
|
| 25 | 7 | $result[$path] = $asset->getOptions()->getAttributes(); |
|
| 26 | 7 | continue; |
|
| 27 | } |
||
| 28 | |||
| 29 | 9 | $link = str_replace( |
|
| 30 | 9 | [ |
|
| 31 | 9 | $this->environment->getCompileDir(), |
|
| 32 | 9 | $this->environment->getProjectDir() |
|
| 33 | 9 | ], |
|
| 34 | 9 | '', |
|
| 35 | 9 | $path |
|
| 36 | 9 | ); |
|
| 37 | |||
| 38 | try { |
||
| 39 | 9 | $asset->getOptions()->setOption( |
|
| 40 | 9 | AssetOption::SYMLINKS, |
|
| 41 | 9 | array_merge( |
|
| 42 | 9 | [$this->environment->getCompileDir() . $link => $path], |
|
| 43 | 9 | $asset->getOptions()->getSymlinks() |
|
| 44 | 9 | ) |
|
| 45 | 9 | ); |
|
| 46 | |||
| 47 | 9 | foreach ($asset->getOptions()->getSymlinks() as $optLink => $optTarget) { |
|
| 48 | 9 | Helpers::createSymlink($optLink, $optTarget, $this->logger); |
|
| 49 | } |
||
| 50 | } catch (\Exception $e) { |
||
| 51 | $this->logger->error($e->getMessage()); |
||
| 52 | } |
||
| 53 | |||
| 54 | |||
| 55 | 9 | $result[$this->environment->getBaseUrl() . str_replace( |
|
| 56 | 9 | DIRECTORY_SEPARATOR, |
|
| 57 | 9 | '/', |
|
| 58 | 9 | $link |
|
| 59 | 9 | )] = $asset->getOptions()->getAttributes(); |
|
| 60 | } |
||
| 61 | |||
| 62 | 16 | return $result; |
|
| 63 | } |
||
| 65 |