@@ -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 | |
@@ -33,7 +33,6 @@ |
||
| 33 | 33 | * @param int $lineNumber |
| 34 | 34 | * @param bool $ignoreError |
| 35 | 35 | * @param bool $tty |
| 36 | - * @param bool $deferred |
|
| 37 | 36 | */ |
| 38 | 37 | public function __construct( |
| 39 | 38 | string $shellCommand, |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | private function createTokenHandler(): array |
| 66 | 66 | { |
| 67 | 67 | return [ |
| 68 | - self::TOKEN_INCLUDE => function (string $currentLine, int $lineNumber, Script $script): string { |
|
| 68 | + self::TOKEN_INCLUDE => function(string $currentLine, int $lineNumber, Script $script): string { |
|
| 69 | 69 | $path = $this->findInclude($script, $this->removeFromStart(self::TOKEN_INCLUDE, $currentLine)); |
| 70 | 70 | $includeScript = new Script(pathinfo($path, PATHINFO_DIRNAME), pathinfo($path, PATHINFO_BASENAME)); |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | return ''; |
| 76 | 76 | }, |
| 77 | 77 | |
| 78 | - self::TOKEN_TEMPLATE => function (string $currentLine, int $lineNumber, Script $script): string { |
|
| 78 | + self::TOKEN_TEMPLATE => function(string $currentLine, int $lineNumber, Script $script): string { |
|
| 79 | 79 | $definition = $this->removeFromStart(self::TOKEN_TEMPLATE, $currentLine); |
| 80 | 80 | list($rawSource, $rawDestination) = explode(':', $definition); |
| 81 | 81 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | return ''; |
| 89 | 89 | }, |
| 90 | 90 | |
| 91 | - self::TOKEN_WAIT => function (string $currentLine, int $lineNumber): string { |
|
| 91 | + self::TOKEN_WAIT => function(string $currentLine, int $lineNumber): string { |
|
| 92 | 92 | $this->commandBuilder |
| 93 | 93 | ->addWaitCommand($lineNumber); |
| 94 | 94 | |
@@ -96,25 +96,25 @@ discard block |
||
| 96 | 96 | return ''; |
| 97 | 97 | }, |
| 98 | 98 | |
| 99 | - self::TOKEN_MODIFIER_IGNORE_ERROR => function (string $currentLine): string { |
|
| 99 | + self::TOKEN_MODIFIER_IGNORE_ERROR => function(string $currentLine): string { |
|
| 100 | 100 | $this->commandBuilder->setIgnoreError(); |
| 101 | 101 | |
| 102 | 102 | return $this->removeFromStart(self::TOKEN_MODIFIER_IGNORE_ERROR, $currentLine); |
| 103 | 103 | }, |
| 104 | 104 | |
| 105 | - self::TOKEN_MODIFIER_TTY => function (string $currentLine): string { |
|
| 105 | + self::TOKEN_MODIFIER_TTY => function(string $currentLine): string { |
|
| 106 | 106 | $this->commandBuilder->setTty(); |
| 107 | 107 | |
| 108 | 108 | return $this->removeFromStart(self::TOKEN_MODIFIER_TTY, $currentLine); |
| 109 | 109 | }, |
| 110 | 110 | |
| 111 | - self::TOKEN_MODIFIER_DEFERRED => function (string $currentLine): string { |
|
| 111 | + self::TOKEN_MODIFIER_DEFERRED => function(string $currentLine): string { |
|
| 112 | 112 | $this->commandBuilder->setDeferredExecution(); |
| 113 | 113 | |
| 114 | 114 | return $this->removeFromStart(self::TOKEN_MODIFIER_DEFERRED, $currentLine); |
| 115 | 115 | }, |
| 116 | 116 | |
| 117 | - self::TOKEN_WILDCARD => function (string $currentLine, int $lineNumber): string { |
|
| 117 | + self::TOKEN_WILDCARD => function(string $currentLine, int $lineNumber): string { |
|
| 118 | 118 | $this->commandBuilder |
| 119 | 119 | ->addProcessCommand($currentLine, $lineNumber); |
| 120 | 120 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | if ($this->startsWith(self::CONCATENATE_PREFIX, $line)) { |
| 209 | 209 | $lastValue = array_pop($lines); |
| 210 | - $lines[] = $lastValue . ' ' . trim($line); |
|
| 210 | + $lines[] = $lastValue . ' ' . trim($line); |
|
| 211 | 211 | |
| 212 | 212 | continue; |
| 213 | 213 | } |
@@ -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 | |
@@ -259,7 +259,6 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | 261 | * @param Process $process |
| 262 | - * @param bool $ignoreError |
|
| 263 | 262 | * @return bool |
| 264 | 263 | */ |
| 265 | 264 | private function isProcessResultValid(Process $process, ProcessCommand $command): bool |
@@ -357,7 +356,7 @@ discard block |
||
| 357 | 356 | |
| 358 | 357 | /** |
| 359 | 358 | * @param DeferredProcess $deferredProcess |
| 360 | - * @param $index |
|
| 359 | + * @param integer $index |
|
| 361 | 360 | */ |
| 362 | 361 | private function logDeferredOutputStart(DeferredProcess $deferredProcess, $index) |
| 363 | 362 | { |