@@ -17,7 +17,7 @@ |
||
17 | 17 | public function filterBestTags(array $tags): array |
18 | 18 | { |
19 | 19 | // filter numeric versions only |
20 | - $versions = \array_filter($tags, function (string $tag) { |
|
20 | + $versions = \array_filter($tags, function(string $tag) { |
|
21 | 21 | return \preg_match('/^\d+(\.\d+)*$/', $tag); |
22 | 22 | }); |
23 | 23 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $response = \GuzzleHttp\json_decode($res->getBody(), true); |
20 | 20 | |
21 | - $tags = \array_map(function (array $item) { |
|
21 | + $tags = \array_map(function(array $item) { |
|
22 | 22 | return $item['name']; |
23 | 23 | }, $response); |
24 | 24 |
@@ -126,7 +126,7 @@ |
||
126 | 126 | throw new \RuntimeException('Payload object should implement JsonSerializable. Got an instance of ' . \get_class($payload)); |
127 | 127 | } |
128 | 128 | $replies = self::dispatch($event, \GuzzleHttp\json_encode($payload)); |
129 | - return \array_map(function (string $reply) { |
|
129 | + return \array_map(function(string $reply) { |
|
130 | 130 | return \GuzzleHttp\json_decode($reply, true); |
131 | 131 | }, $replies); |
132 | 132 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function __construct() |
46 | 46 | { |
47 | - $this->validatorSchema = \GuzzleHttp\json_decode((string)file_get_contents(__DIR__ . '/ServiceJsonSchema.json'), false); |
|
47 | + $this->validatorSchema = \GuzzleHttp\json_decode((string) file_get_contents(__DIR__ . '/ServiceJsonSchema.json'), false); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function jsonSerialize(): array |
94 | 94 | { |
95 | - $jsonSerializeMap = function (\JsonSerializable $obj): array { |
|
95 | + $jsonSerializeMap = function(\JsonSerializable $obj): array { |
|
96 | 96 | return $obj->jsonSerialize(); |
97 | 97 | }; |
98 | 98 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $dockerfileCommands[] = 'FROM ' . $this->image; |
136 | 136 | foreach ($this->environment as $key => $env) { |
137 | 137 | if ($env->getType() === EnvVariableTypeEnum::IMAGE_ENV_VARIABLE) { |
138 | - $dockerfileCommands[] = "ENV $key" . '='. $env->getValue(); |
|
138 | + $dockerfileCommands[] = "ENV $key" . '=' . $env->getValue(); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | foreach ($this->volumes as $volume) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $validator = $this->validator; |
113 | 113 | |
114 | 114 | if ($this->yesNoQuestion) { |
115 | - $validator = function (?string $response) use ($validator) { |
|
115 | + $validator = function(?string $response) use ($validator) { |
|
116 | 116 | $response = $response ?? ''; |
117 | 117 | $response = \strtolower(trim($response)); |
118 | 118 | if (!\in_array($response, ['y', 'n', 'yes', 'no'])) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($this->helpText !== null) { |
127 | - $validator = function (?string $response) use ($validator) { |
|
127 | + $validator = function(?string $response) use ($validator) { |
|
128 | 128 | $response = $response ?? ''; |
129 | 129 | if (trim($response) === '?') { |
130 | 130 | $this->output->writeln($this->helpText ?: ''); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | if ($this->compulsory) { |
138 | - $validator = function (?string $response) use ($validator) { |
|
138 | + $validator = function(?string $response) use ($validator) { |
|
139 | 139 | $response = $response ?? ''; |
140 | 140 | if (trim($response) === '') { |
141 | 141 | throw new \InvalidArgumentException('This field is compulsory.'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function getAlphaValidator(?array $additionalCharacters = null, ?string $hint = null): \Closure |
13 | 13 | { |
14 | - return function (string $value) use ($additionalCharacters, $hint) { |
|
14 | + return function(string $value) use ($additionalCharacters, $hint) { |
|
15 | 15 | $value = trim($value); |
16 | 16 | $pattern = '/^[a-zA-Z0-9'; |
17 | 17 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public static function getAbsolutePathValidator(): \Closure |
39 | 39 | { |
40 | - return function (string $value) { |
|
40 | + return function(string $value) { |
|
41 | 41 | $value = trim($value); |
42 | 42 | if (!\preg_match('/^[\'"]?(?:\/[^\/\n]+)*[\'"]?$/', $value)) { |
43 | 43 | throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: path has to be absolute without trailing "/".'); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public static function getDomainNameValidator(): \Closure |
50 | 50 | { |
51 | - return function (string $value) { |
|
51 | + return function(string $value) { |
|
52 | 52 | $value = trim($value); |
53 | 53 | if (!\preg_match('/^(?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?$/im', $value)) { |
54 | 54 | throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the domain name must not start with "http(s)://".'); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public static function getDomainNameWithPortValidator(): \Closure |
61 | 61 | { |
62 | - return function (string $value) { |
|
62 | + return function(string $value) { |
|
63 | 63 | $value = trim($value); |
64 | 64 | if (!\preg_match('/^(?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?:[0-9]*$/im', $value)) { |
65 | 65 | throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the domain name must not start with "http(s)://".'); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public static function getIPv4Validator(): \Closure |
72 | 72 | { |
73 | - return function (string $value) { |
|
73 | + return function(string $value) { |
|
74 | 74 | $value = trim($value); |
75 | 75 | if (!\preg_match('/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/', $value)) { |
76 | 76 | throw new \InvalidArgumentException('Invalid value "' . $value . '".'); |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $choices = $this->choices; |
87 | 87 | $errorMessage = 'Value "%s" is invalid'; |
88 | 88 | $multiselect = $this->multiselect; |
89 | - $isAssoc = (bool)count(array_filter(array_keys($this->choices), '\is_string')); |
|
89 | + $isAssoc = (bool) count(array_filter(array_keys($this->choices), '\is_string')); |
|
90 | 90 | |
91 | - return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
91 | + return function($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
92 | 92 | |
93 | 93 | // Collapse all spaces. |
94 | 94 | $selectedChoices = str_replace(' ', '', $selected); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if (false === $result) { |
137 | 137 | throw new InvalidArgumentException(sprintf($errorMessage, $value)); |
138 | 138 | } |
139 | - $multiselectChoices[] = (string)$result; |
|
139 | + $multiselectChoices[] = (string) $result; |
|
140 | 140 | } |
141 | 141 | if ($multiselect) { |
142 | 142 | if ($this->printAnswer) { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $question->setAutocompleterValues($availableVersions); |
66 | 66 | |
67 | - $question->setValidator(function (string $value) use ($availableVersions, $dockerHubImage) { |
|
67 | + $question->setValidator(function(string $value) use ($availableVersions, $dockerHubImage) { |
|
68 | 68 | $value = trim($value); |
69 | 69 | |
70 | 70 | if ($value === 'v') { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $environmentsStr = []; |
122 | 122 | foreach ($environments as $env) { |
123 | - $environmentsStr[] = $env[CommonMetadata::ENV_NAME_KEY] . ' (of type '. $env[CommonMetadata::ENV_TYPE_KEY] .')'; |
|
123 | + $environmentsStr[] = $env[CommonMetadata::ENV_NAME_KEY] . ' (of type ' . $env[CommonMetadata::ENV_TYPE_KEY] . ')'; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | $chosen = $this->factory->choiceQuestion('Environments', $environmentsStr, false) |
@@ -71,9 +71,9 @@ |
||
71 | 71 | */ |
72 | 72 | public function getAllEventNames(): array |
73 | 73 | { |
74 | - return array_map(function (AbstractEventCommand $event) { |
|
74 | + return array_map(function(AbstractEventCommand $event) { |
|
75 | 75 | return $event->getEventName(); |
76 | - }, \array_filter($this->getApplication()->all(), function (Command $command) { |
|
76 | + }, \array_filter($this->getApplication()->all(), function(Command $command) { |
|
77 | 77 | return $command instanceof AbstractEventCommand && !$command->isHidden(); |
78 | 78 | })); |
79 | 79 | } |