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