| Conditions | 5 |
| Paths | 5 |
| Total Lines | 33 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | protected function getSource($packagePath) |
||
| 28 | { |
||
| 29 | $sources = [ |
||
| 30 | "{$packagePath}/resources/config", |
||
| 31 | "{$packagePath}/config", |
||
| 32 | ]; |
||
| 33 | |||
| 34 | // iterate through all possible locations |
||
| 35 | foreach ($sources as $source) { |
||
| 36 | if ($this->files->isDirectory($source)) { |
||
| 37 | $paths = []; |
||
| 38 | |||
| 39 | // get all files of the current directory |
||
| 40 | $files = $this->getSourceFiles($source); |
||
| 41 | |||
| 42 | // iterate through all files |
||
| 43 | foreach ($files as $file) { |
||
| 44 | $destinationPath = $this->getDestinationPath('config', [ |
||
| 45 | $this->getFileName($file), |
||
| 46 | ]); |
||
| 47 | |||
| 48 | // if the destination doesn't exist we can add the file to the queue |
||
| 49 | if (!File::exists($destinationPath)) { |
||
| 50 | $paths[$file] = $destinationPath; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | return $paths; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | throw new InvalidArgumentException('Configuration not found.'); |
||
| 59 | } |
||
| 60 | } |
||
| 61 |