@@ -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); |
@@ -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 | |
@@ -48,19 +48,19 @@ |
||
| 48 | 48 | return $globResult; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $overrideFiles = array_filter($globResult, function (string $file) { |
|
| 51 | + $overrideFiles = 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 | - $distFiles = array_filter($globResult, function (string $file) { |
|
| 57 | + $distFiles = array_filter($globResult, function(string $file) { |
|
| 58 | 58 | $extension = pathinfo($file, PATHINFO_EXTENSION); |
| 59 | 59 | |
| 60 | 60 | return $extension === 'dist'; |
| 61 | 61 | }); |
| 62 | 62 | |
| 63 | - $configFiles = array_filter($globResult, function (string $file) { |
|
| 63 | + $configFiles = array_filter($globResult, function(string $file) { |
|
| 64 | 64 | $extension = pathinfo($file, PATHINFO_EXTENSION); |
| 65 | 65 | |
| 66 | 66 | return $extension !== 'override' && $extension !== 'dist'; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | $pathNodes = $this->extractNodes(self::NODE_PATH, $pshConfigNode); |
| 158 | 158 | |
| 159 | - return array_map(function (DOMElement $path) use ($file) { |
|
| 159 | + return array_map(function(DOMElement $path) use ($file) { |
|
| 160 | 160 | return $this->fixPath($this->applicationRootDirectory, $path->nodeValue, $file); |
| 161 | 161 | }, $pathNodes); |
| 162 | 162 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | $templates = $this->extractNodes(self::NODE_TEMPLATE, $pshConfigNodes); |
| 172 | 172 | |
| 173 | - return array_map(function (DOMElement $template) use ($file) { |
|
| 173 | + return array_map(function(DOMElement $template) use ($file) { |
|
| 174 | 174 | return [ |
| 175 | 175 | 'source' => $this->fixPath( |
| 176 | 176 | $this->applicationRootDirectory, |
@@ -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 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @param array $constants |
| 43 | 43 | * @param array $variables |
| 44 | 44 | * @param array $templates |
| 45 | - * @param array $dotenvPaths |
|
| 45 | + * @param ScriptPath[] $dotenvPaths |
|
| 46 | 46 | */ |
| 47 | 47 | public function __construct(array $constants, array $variables, array $templates, array $dotenvPaths) |
| 48 | 48 | { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | public function createTokenHandler(): array |
| 81 | 81 | { |
| 82 | 82 | return [ |
| 83 | - self::TOKEN_ACTION => function (string $currentLine): string { |
|
| 83 | + self::TOKEN_ACTION => function(string $currentLine): string { |
|
| 84 | 84 | $scriptName = $this->removeFromStart(self::TOKEN_ACTION, $currentLine); |
| 85 | 85 | $actionScript = $this->scriptFinder->findScriptByName($scriptName); |
| 86 | 86 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return ''; |
| 91 | 91 | }, |
| 92 | 92 | |
| 93 | - self::TOKEN_INCLUDE => function (string $currentLine, int $lineNumber, Script $script): string { |
|
| 93 | + self::TOKEN_INCLUDE => function(string $currentLine, int $lineNumber, Script $script): string { |
|
| 94 | 94 | $path = $this->findInclude($script, $this->removeFromStart(self::TOKEN_INCLUDE, $currentLine)); |
| 95 | 95 | $includeScript = new Script(pathinfo($path, PATHINFO_DIRNAME), pathinfo($path, PATHINFO_BASENAME)); |
| 96 | 96 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | return ''; |
| 101 | 101 | }, |
| 102 | 102 | |
| 103 | - self::TOKEN_TEMPLATE => function (string $currentLine, int $lineNumber, Script $script): string { |
|
| 103 | + self::TOKEN_TEMPLATE => function(string $currentLine, int $lineNumber, Script $script): string { |
|
| 104 | 104 | $definition = $this->removeFromStart(self::TOKEN_TEMPLATE, $currentLine); |
| 105 | 105 | list($rawSource, $rawDestination) = explode(':', $definition); |
| 106 | 106 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | return ''; |
| 114 | 114 | }, |
| 115 | 115 | |
| 116 | - self::TOKEN_WAIT => function (string $currentLine, int $lineNumber): string { |
|
| 116 | + self::TOKEN_WAIT => function(string $currentLine, int $lineNumber): string { |
|
| 117 | 117 | $this->commandBuilder |
| 118 | 118 | ->addWaitCommand($lineNumber); |
| 119 | 119 | |
@@ -121,25 +121,25 @@ discard block |
||
| 121 | 121 | return ''; |
| 122 | 122 | }, |
| 123 | 123 | |
| 124 | - self::TOKEN_MODIFIER_IGNORE_ERROR => function (string $currentLine): string { |
|
| 124 | + self::TOKEN_MODIFIER_IGNORE_ERROR => function(string $currentLine): string { |
|
| 125 | 125 | $this->commandBuilder->setIgnoreError(); |
| 126 | 126 | |
| 127 | 127 | return $this->removeFromStart(self::TOKEN_MODIFIER_IGNORE_ERROR, $currentLine); |
| 128 | 128 | }, |
| 129 | 129 | |
| 130 | - self::TOKEN_MODIFIER_TTY => function (string $currentLine): string { |
|
| 130 | + self::TOKEN_MODIFIER_TTY => function(string $currentLine): string { |
|
| 131 | 131 | $this->commandBuilder->setTty(); |
| 132 | 132 | |
| 133 | 133 | return $this->removeFromStart(self::TOKEN_MODIFIER_TTY, $currentLine); |
| 134 | 134 | }, |
| 135 | 135 | |
| 136 | - self::TOKEN_MODIFIER_DEFERRED => function (string $currentLine): string { |
|
| 136 | + self::TOKEN_MODIFIER_DEFERRED => function(string $currentLine): string { |
|
| 137 | 137 | $this->commandBuilder->setDeferredExecution(); |
| 138 | 138 | |
| 139 | 139 | return $this->removeFromStart(self::TOKEN_MODIFIER_DEFERRED, $currentLine); |
| 140 | 140 | }, |
| 141 | 141 | |
| 142 | - self::TOKEN_WILDCARD => function (string $currentLine, int $lineNumber): string { |
|
| 142 | + self::TOKEN_WILDCARD => function(string $currentLine, int $lineNumber): string { |
|
| 143 | 143 | $this->commandBuilder |
| 144 | 144 | ->addProcessCommand($currentLine, $lineNumber); |
| 145 | 145 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | if ($this->startsWith(self::CONCATENATE_PREFIX, $line)) { |
| 234 | 234 | $lastValue = array_pop($lines); |
| 235 | - $lines[] = $lastValue . ' ' . trim($line); |
|
| 235 | + $lines[] = $lastValue . ' ' . trim($line); |
|
| 236 | 236 | |
| 237 | 237 | continue; |
| 238 | 238 | } |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * @param string|null $environmentString |
|
| 106 | + * @param string|null $environment |
|
| 107 | 107 | * |
| 108 | 108 | * @return ScriptPath[] |
| 109 | 109 | */ |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | [$this->getEnvironment($environment), 'getDotenvPaths'] |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - return array_map(function (string $path): ScriptPath { |
|
| 117 | + return array_map(function(string $path): ScriptPath { |
|
| 118 | 118 | return new ScriptPath($path, null); |
| 119 | 119 | }, $paths); |
| 120 | 120 | } |