| Conditions | 6 |
| Paths | 9 |
| Total Lines | 41 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 6.3357 |
| Changes | 4 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 14 | 8 | public function getResult(): array |
|
| 15 | { |
||
| 16 | 8 | $result = []; |
|
| 17 | |||
| 18 | 8 | foreach ($this->assetsCollection as $asset) { |
|
| 19 | 8 | if (false === $path = $asset->getPath()) { |
|
| 20 | continue; |
||
| 21 | } |
||
| 22 | |||
| 23 | 8 | if ($asset->isUrl()) { |
|
| 24 | 5 | $result[] = $path; |
|
| 25 | 5 | continue; |
|
| 26 | } |
||
| 27 | |||
| 28 | 5 | $link = str_replace( |
|
| 29 | [ |
||
| 30 | 5 | $this->environment->getCompileDir(), |
|
| 31 | 5 | $this->environment->getProjectDir() |
|
| 32 | ], |
||
| 33 | '', |
||
| 34 | $path |
||
| 35 | ); |
||
| 36 | |||
| 37 | try { |
||
| 38 | 5 | Helpers::createSymlink($this->environment->getCompileDir() . $link, $path, $this->logger); |
|
| 39 | |||
| 40 | 5 | $optSymlinks = (array)$asset->getOption(Asset::CREATE_SYMLINK, []); |
|
| 41 | |||
| 42 | /** @var array<string, string> $optSymlinks */ |
||
| 43 | 5 | foreach ($optSymlinks as $optLink => $optTarget) { |
|
| 44 | Helpers::createSymlink($optLink, $optTarget, $this->logger); |
||
| 45 | } |
||
| 46 | } catch (\Exception $e) { |
||
| 47 | $this->logger->error($e->getMessage()); |
||
| 48 | } |
||
| 49 | |||
| 50 | |||
| 51 | 5 | $result[] = $this->environment->getBaseUrl() . str_replace(DIRECTORY_SEPARATOR, '/', $link); |
|
| 52 | } |
||
| 53 | |||
| 54 | 8 | return $result; |
|
| 55 | } |
||
| 57 |