| Conditions | 7 |
| Paths | 13 |
| Total Lines | 27 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 7.0572 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | 2 | public function process($configs) |
|
| 41 | { |
||
| 42 | 2 | if (!isset($configs['files'])) { |
|
| 43 | return true; |
||
| 44 | } |
||
| 45 | |||
| 46 | 2 | $files = $configs['files']; |
|
| 47 | 2 | if (array_keys($files) !== range(0, count($files) - 1)) { |
|
| 48 | 1 | $files = array($files); |
|
| 49 | 1 | } |
|
| 50 | 2 | foreach ($files as $file) { |
|
| 51 | 2 | if (!is_array($file)) { |
|
| 52 | throw new \InvalidArgumentException('The extra.environment-parameters.files setting must be an array.'); |
||
| 53 | } |
||
| 54 | |||
| 55 | 2 | $path = $this->fileHandler->preparePath($file['file']); |
|
| 56 | 2 | $destination = $configs['build-folder'] . '/' . (isset($file['name']) ? $file['name'] : $path); |
|
| 57 | 2 | $this->fs->copy($path, $destination, true); |
|
| 58 | 2 | if (isset($file['name'])) { |
|
| 59 | 1 | $this->io->write(sprintf('<info>Copying the "%s" into "%s" file</info>', $path, $destination)); |
|
| 60 | 1 | } else { |
|
| 61 | 1 | $this->io->write(sprintf('<info>Copying the "%s" file</info>', $path)); |
|
| 62 | } |
||
| 63 | |||
| 64 | 2 | } |
|
| 65 | 2 | return true; |
|
| 66 | } |
||
| 67 | |||
| 69 |