@@ -135,6 +135,9 @@ |
||
135 | 135 | return $reformattedParams; |
136 | 136 | } |
137 | 137 | |
138 | + /** |
|
139 | + * @param string $directory |
|
140 | + */ |
|
138 | 141 | public function getConfigFiles($directory): array |
139 | 142 | { |
140 | 143 | return (new ConfigFileFinder())->discoverFiles($directory); |
@@ -48,13 +48,13 @@ |
||
48 | 48 | return $globResult; |
49 | 49 | } |
50 | 50 | |
51 | - $overrideFile = array_filter($globResult, function (string $file) { |
|
51 | + $overrideFile = array_filter($globResult, function(string $file) { |
|
52 | 52 | $extension = pathinfo($file, PATHINFO_EXTENSION); |
53 | 53 | |
54 | 54 | return $extension === 'override'; |
55 | 55 | }); |
56 | 56 | |
57 | - $configFile = array_filter($globResult, function (string $file) { |
|
57 | + $configFile = array_filter($globResult, function(string $file) { |
|
58 | 58 | $extension = pathinfo($file, PATHINFO_EXTENSION); |
59 | 59 | |
60 | 60 | return $extension !== 'override'; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $paths = $this->extractData(self::KEY_COMMAND_PATHS, $rawConfigData, []); |
152 | 152 | |
153 | - return array_map(function ($path) use ($file) { |
|
153 | + return array_map(function($path) use ($file) { |
|
154 | 154 | return $this->fixPath($path, $file); |
155 | 155 | }, $paths); |
156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | { |
165 | 165 | $templates = $this->extractData(self::KEY_TEMPLATES, $rawConfigData, []); |
166 | 166 | |
167 | - return array_map(function ($template) use ($file) { |
|
167 | + return array_map(function($template) use ($file) { |
|
168 | 168 | $template['source'] = $this->fixPath($template['source'], $file); |
169 | 169 | $template['destination'] = $this->makeAbsolutePath($file, $template['destination']); |
170 | 170 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | { |
79 | 79 | $scripts = $this->getAllScripts(); |
80 | 80 | |
81 | - return array_filter($scripts, function ($key) use ($query) { |
|
81 | + return array_filter($scripts, function($key) use ($query) { |
|
82 | 82 | return strpos($key, $query) > -1 || levenshtein($key, $query) < 3; |
83 | 83 | }, ARRAY_FILTER_USE_KEY); |
84 | 84 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | { |
211 | 211 | $countConfigFiles = count($configFiles); |
212 | 212 | for ($i = 0; $i < $countConfigFiles; $i++) { |
213 | - $configFiles[$i] = str_replace($this->rootDirectory."/", "", $configFiles[$i]); |
|
213 | + $configFiles[$i] = str_replace($this->rootDirectory . "/", "", $configFiles[$i]); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | if (count($configFiles) == 1) { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | $scripts = $scriptFinder->getAllScripts(); |
248 | 248 | |
249 | - $commands = array_map(function (Script $script) { |
|
249 | + $commands = array_map(function(Script $script) { |
|
250 | 250 | return $script->getName(); |
251 | 251 | }, $scripts); |
252 | 252 |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | private function runProcess(Process $process) |
186 | 186 | { |
187 | - $process->run(function ($type, $response) { |
|
187 | + $process->run(function($type, $response) { |
|
188 | 188 | $this->logger->log(new LogMessage($response, $type === Process::ERR)); |
189 | 189 | }); |
190 | 190 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | { |
263 | 263 | $deferredProcess = new DeferredProcess($parsedCommand, $command, $process); |
264 | 264 | |
265 | - $process->start(function ($type, $response) use ($deferredProcess) { |
|
265 | + $process->start(function($type, $response) use ($deferredProcess) { |
|
266 | 266 | $deferredProcess->log(new LogMessage($response, $type === Process::ERR)); |
267 | 267 | }); |
268 | 268 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function createTokenHandler(): array |
80 | 80 | { |
81 | 81 | return [ |
82 | - self::TOKEN_ACTION => function (string $currentLine, int $lineNumber, Script $script): string { |
|
82 | + self::TOKEN_ACTION => function(string $currentLine, int $lineNumber, Script $script): string { |
|
83 | 83 | $scriptName = $this->removeFromStart(self::TOKEN_ACTION, $currentLine); |
84 | 84 | $actionScript = $this->scriptFinder->findScriptByName($scriptName); |
85 | 85 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | return ''; |
93 | 93 | }, |
94 | 94 | |
95 | - self::TOKEN_INCLUDE => function (string $currentLine, int $lineNumber, Script $script): string { |
|
95 | + self::TOKEN_INCLUDE => function(string $currentLine, int $lineNumber, Script $script): string { |
|
96 | 96 | $path = $this->findInclude($script, $this->removeFromStart(self::TOKEN_INCLUDE, $currentLine)); |
97 | 97 | $includeScript = new Script(pathinfo($path, PATHINFO_DIRNAME), pathinfo($path, PATHINFO_BASENAME)); |
98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return ''; |
103 | 103 | }, |
104 | 104 | |
105 | - self::TOKEN_TEMPLATE => function (string $currentLine, int $lineNumber, Script $script): string { |
|
105 | + self::TOKEN_TEMPLATE => function(string $currentLine, int $lineNumber, Script $script): string { |
|
106 | 106 | $definition = $this->removeFromStart(self::TOKEN_TEMPLATE, $currentLine); |
107 | 107 | list($rawSource, $rawDestination) = explode(':', $definition); |
108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return ''; |
116 | 116 | }, |
117 | 117 | |
118 | - self::TOKEN_WAIT => function (string $currentLine, int $lineNumber): string { |
|
118 | + self::TOKEN_WAIT => function(string $currentLine, int $lineNumber): string { |
|
119 | 119 | $this->commandBuilder |
120 | 120 | ->addWaitCommand($lineNumber); |
121 | 121 | |
@@ -123,25 +123,25 @@ discard block |
||
123 | 123 | return ''; |
124 | 124 | }, |
125 | 125 | |
126 | - self::TOKEN_MODIFIER_IGNORE_ERROR => function (string $currentLine): string { |
|
126 | + self::TOKEN_MODIFIER_IGNORE_ERROR => function(string $currentLine): string { |
|
127 | 127 | $this->commandBuilder->setIgnoreError(); |
128 | 128 | |
129 | 129 | return $this->removeFromStart(self::TOKEN_MODIFIER_IGNORE_ERROR, $currentLine); |
130 | 130 | }, |
131 | 131 | |
132 | - self::TOKEN_MODIFIER_TTY => function (string $currentLine): string { |
|
132 | + self::TOKEN_MODIFIER_TTY => function(string $currentLine): string { |
|
133 | 133 | $this->commandBuilder->setTty(); |
134 | 134 | |
135 | 135 | return $this->removeFromStart(self::TOKEN_MODIFIER_TTY, $currentLine); |
136 | 136 | }, |
137 | 137 | |
138 | - self::TOKEN_MODIFIER_DEFERRED => function (string $currentLine): string { |
|
138 | + self::TOKEN_MODIFIER_DEFERRED => function(string $currentLine): string { |
|
139 | 139 | $this->commandBuilder->setDeferredExecution(); |
140 | 140 | |
141 | 141 | return $this->removeFromStart(self::TOKEN_MODIFIER_DEFERRED, $currentLine); |
142 | 142 | }, |
143 | 143 | |
144 | - self::TOKEN_WILDCARD => function (string $currentLine, int $lineNumber): string { |
|
144 | + self::TOKEN_WILDCARD => function(string $currentLine, int $lineNumber): string { |
|
145 | 145 | $this->commandBuilder |
146 | 146 | ->addProcessCommand($currentLine, $lineNumber); |
147 | 147 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | if ($this->startsWith(self::CONCATENATE_PREFIX, $line)) { |
236 | 236 | $lastValue = array_pop($lines); |
237 | - $lines[] = $lastValue . ' ' . trim($line); |
|
237 | + $lines[] = $lastValue . ' ' . trim($line); |
|
238 | 238 | |
239 | 239 | continue; |
240 | 240 | } |