@@ -114,6 +114,9 @@ |
||
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | + /** |
|
118 | + * @param string $description |
|
119 | + */ |
|
117 | 120 | public function addRequirePlaceholder(string $name, ?string $description = null): ConfigBuilder |
118 | 121 | { |
119 | 122 | $this->currentRequiredVariables[$name] = $description; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | private function createTokenHandler(ScriptLoader $loader): array |
80 | 80 | { |
81 | 81 | return [ |
82 | - self::TOKEN_ACTION => function (string $currentLine) use ($loader): string { |
|
82 | + self::TOKEN_ACTION => function(string $currentLine) use ($loader): string { |
|
83 | 83 | $scriptName = $this->removeFromStart(self::TOKEN_ACTION, $currentLine); |
84 | 84 | $actionScript = $this->scriptFinder->findScriptByName($scriptName); |
85 | 85 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return ''; |
90 | 90 | }, |
91 | 91 | |
92 | - self::TOKEN_INCLUDE => function (string $currentLine, int $lineNumber, Script $script) use ($loader): string { |
|
92 | + self::TOKEN_INCLUDE => function(string $currentLine, int $lineNumber, Script $script) use ($loader): string { |
|
93 | 93 | $path = $this->findInclude($script, $this->removeFromStart(self::TOKEN_INCLUDE, $currentLine)); |
94 | 94 | $includeScript = new Script(pathinfo($path, PATHINFO_DIRNAME), pathinfo($path, PATHINFO_BASENAME), false, $script->getWorkingDirectory()); |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | return ''; |
100 | 100 | }, |
101 | 101 | |
102 | - self::TOKEN_TEMPLATE => function (string $currentLine, int $lineNumber, Script $script): string { |
|
102 | + self::TOKEN_TEMPLATE => function(string $currentLine, int $lineNumber, Script $script): string { |
|
103 | 103 | $definition = $this->removeFromStart(self::TOKEN_TEMPLATE, $currentLine); |
104 | 104 | list($rawSource, $rawDestination) = explode(':', $definition); |
105 | 105 | |
@@ -112,32 +112,32 @@ discard block |
||
112 | 112 | return ''; |
113 | 113 | }, |
114 | 114 | |
115 | - self::TOKEN_WAIT => function (string $currentLine, int $lineNumber): string { |
|
115 | + self::TOKEN_WAIT => function(string $currentLine, int $lineNumber): string { |
|
116 | 116 | $this->commandBuilder |
117 | 117 | ->addWaitCommand($lineNumber); |
118 | 118 | |
119 | 119 | return ''; |
120 | 120 | }, |
121 | 121 | |
122 | - self::TOKEN_MODIFIER_IGNORE_ERROR => function (string $currentLine): string { |
|
122 | + self::TOKEN_MODIFIER_IGNORE_ERROR => function(string $currentLine): string { |
|
123 | 123 | $this->commandBuilder->setIgnoreError(); |
124 | 124 | |
125 | 125 | return $this->removeFromStart(self::TOKEN_MODIFIER_IGNORE_ERROR, $currentLine); |
126 | 126 | }, |
127 | 127 | |
128 | - self::TOKEN_MODIFIER_TTY => function (string $currentLine): string { |
|
128 | + self::TOKEN_MODIFIER_TTY => function(string $currentLine): string { |
|
129 | 129 | $this->commandBuilder->setTty(); |
130 | 130 | |
131 | 131 | return $this->removeFromStart(self::TOKEN_MODIFIER_TTY, $currentLine); |
132 | 132 | }, |
133 | 133 | |
134 | - self::TOKEN_MODIFIER_DEFERRED => function (string $currentLine): string { |
|
134 | + self::TOKEN_MODIFIER_DEFERRED => function(string $currentLine): string { |
|
135 | 135 | $this->commandBuilder->setDeferredExecution(); |
136 | 136 | |
137 | 137 | return $this->removeFromStart(self::TOKEN_MODIFIER_DEFERRED, $currentLine); |
138 | 138 | }, |
139 | 139 | |
140 | - self::TOKEN_WILDCARD => function (string $currentLine, int $lineNumber, Script $script): string { |
|
140 | + self::TOKEN_WILDCARD => function(string $currentLine, int $lineNumber, Script $script): string { |
|
141 | 141 | $this->commandBuilder |
142 | 142 | ->addProcessCommand($currentLine, $lineNumber, $script->getWorkingDirectory()); |
143 | 143 |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $paths = $this->extractData($key, $rawConfigData, []); |
132 | 132 | |
133 | - return array_map(function ($path) use ($file) { |
|
133 | + return array_map(function($path) use ($file) { |
|
134 | 134 | return $this->fixPath($this->applicationRootDirectory, $path, $file); |
135 | 135 | }, $paths); |
136 | 136 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $templates = $this->extractData(self::KEY_TEMPLATES, $rawConfigData, []); |
141 | 141 | |
142 | - return array_map(function ($template) use ($file) { |
|
142 | + return array_map(function($template) use ($file) { |
|
143 | 143 | $template['source'] = $this->fixPath($this->applicationRootDirectory, $template['source'], $file); |
144 | 144 | |
145 | 145 | return $template; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | private function getPaddingSize(array $scripts): int |
151 | 151 | { |
152 | - return self::MIN_PADDING_SIZE + max(array_map(static function (Script $script) { |
|
152 | + return self::MIN_PADDING_SIZE + max(array_map(static function(Script $script) { |
|
153 | 153 | return mb_strlen($script->getName()); |
154 | 154 | }, $scripts)); |
155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | $scripts = $scriptFinder->getAllVisibleScripts(); |
163 | 163 | |
164 | - $commands = array_map(function (Script $script) { |
|
164 | + $commands = array_map(function(Script $script) { |
|
165 | 165 | return $script->getName(); |
166 | 166 | }, $scripts); |
167 | 167 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | private function printHead(Config $config, ApplicationConfigLogger $logger): void |
185 | 185 | { |
186 | - if($config->hasOption(ApplicationOptions::FLAG_NO_HEADER)) { |
|
186 | + if ($config->hasOption(ApplicationOptions::FLAG_NO_HEADER)) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $commandsAreAt = 0; |
31 | 31 | |
32 | 32 | $appOptions = []; |
33 | - foreach($params as $commandsAreAt => $param) { |
|
34 | - if(!in_array($param, ApplicationOptions::getAllFlags())) { |
|
33 | + foreach ($params as $commandsAreAt => $param) { |
|
34 | + if (!in_array($param, ApplicationOptions::getAllFlags())) { |
|
35 | 35 | break; |
36 | 36 | } |
37 | 37 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | private function explodeScriptNames(array $params, int $position): array |
99 | 99 | { |
100 | - if(!isset($params[$position])) { |
|
100 | + if (!isset($params[$position])) { |
|
101 | 101 | return []; |
102 | 102 | } |
103 | 103 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | public function getAllVisibleScripts(): array |
69 | 69 | { |
70 | - return array_filter($this->getAllScripts(), static function (Script $script): bool { |
|
70 | + return array_filter($this->getAllScripts(), static function(Script $script): bool { |
|
71 | 71 | return !$script->isHidden(); |
72 | 72 | }); |
73 | 73 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $scripts = $this->getAllVisibleScripts(); |
78 | 78 | |
79 | - return array_filter($scripts, static function ($key) use ($query) { |
|
79 | + return array_filter($scripts, static function($key) use ($query) { |
|
80 | 80 | return mb_strpos($key, $query) > -1 || levenshtein($key, $query) < 3; |
81 | 81 | }, ARRAY_FILTER_USE_KEY); |
82 | 82 | } |
@@ -61,19 +61,19 @@ |
||
61 | 61 | return $configFileCandidates; |
62 | 62 | } |
63 | 63 | |
64 | - $overrideFiles = array_filter($configFileCandidates, static function (string $file) { |
|
64 | + $overrideFiles = array_filter($configFileCandidates, static function(string $file) { |
|
65 | 65 | $extension = pathinfo($file, PATHINFO_EXTENSION); |
66 | 66 | |
67 | 67 | return $extension === 'override'; |
68 | 68 | }); |
69 | 69 | |
70 | - $distFiles = array_filter($configFileCandidates, static function (string $file) { |
|
70 | + $distFiles = array_filter($configFileCandidates, static function(string $file) { |
|
71 | 71 | $extension = pathinfo($file, PATHINFO_EXTENSION); |
72 | 72 | |
73 | 73 | return $extension === 'dist'; |
74 | 74 | }); |
75 | 75 | |
76 | - $configFiles = array_filter($configFileCandidates, static function (string $file) { |
|
76 | + $configFiles = array_filter($configFileCandidates, static function(string $file) { |
|
77 | 77 | $extension = pathinfo($file, PATHINFO_EXTENSION); |
78 | 78 | |
79 | 79 | return $extension !== 'override' && $extension !== 'dist'; |
@@ -143,7 +143,7 @@ |
||
143 | 143 | [$this->getEnvironment($environment), 'getDotenvPaths'] |
144 | 144 | ); |
145 | 145 | |
146 | - return array_map(static function (string $path): DotenvFile { |
|
146 | + return array_map(static function(string $path): DotenvFile { |
|
147 | 147 | return new DotenvFile($path); |
148 | 148 | }, $paths); |
149 | 149 | } |