@@ -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 | } |
@@ -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 | } |
@@ -7,6 +7,6 @@ |
||
7 | 7 | { |
8 | 8 | public static function cannotHandleEvent(string $eventName): self |
9 | 9 | { |
10 | - return new self('Could not find an Aent that can handle events of type "'.$eventName.'"'); |
|
10 | + return new self('Could not find an Aent that can handle events of type "' . $eventName . '"'); |
|
11 | 11 | } |
12 | 12 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | public function __construct(string $replyDirectory = null) |
16 | 16 | { |
17 | 17 | if ($replyDirectory === null) { |
18 | - $replyDirectory = \sys_get_temp_dir().'/replies'; |
|
18 | + $replyDirectory = \sys_get_temp_dir() . '/replies'; |
|
19 | 19 | } |
20 | - $this->replyDirectory = rtrim($replyDirectory, '/').'/'; |
|
20 | + $this->replyDirectory = rtrim($replyDirectory, '/') . '/'; |
|
21 | 21 | if (!\file_exists($replyDirectory)) { |
22 | 22 | if (!mkdir($replyDirectory, 0777, true) && !is_dir($replyDirectory)) { |
23 | 23 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $replyDirectory)); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function clear(): void |
32 | 32 | { |
33 | - $files = glob($this->replyDirectory.'*'); // get all file names |
|
33 | + $files = glob($this->replyDirectory . '*'); // get all file names |
|
34 | 34 | foreach ($files as $file) { // iterate files |
35 | 35 | if (is_file($file)) { |
36 | 36 | unlink($file); // delete file |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | private function getNextFileName(): string |
42 | 42 | { |
43 | 43 | $i = 0; |
44 | - while (\file_exists($this->replyDirectory.'tmp'.$i)) { |
|
44 | + while (\file_exists($this->replyDirectory . 'tmp' . $i)) { |
|
45 | 45 | $i++; |
46 | 46 | } |
47 | - return 'tmp'.$i; |
|
47 | + return 'tmp' . $i; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function storeReply(string $payload): void |
51 | 51 | { |
52 | - $path = $this->replyDirectory.$this->getNextFileName(); |
|
52 | + $path = $this->replyDirectory . $this->getNextFileName(); |
|
53 | 53 | \file_put_contents($path, $payload); |
54 | 54 | } |
55 | 55 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | { |
61 | 61 | $i = 0; |
62 | 62 | $replies = []; |
63 | - while (\file_exists($this->replyDirectory.'tmp'.$i)) { |
|
64 | - $content = \file_get_contents($this->replyDirectory.'tmp'.$i); |
|
63 | + while (\file_exists($this->replyDirectory . 'tmp' . $i)) { |
|
64 | + $content = \file_get_contents($this->replyDirectory . 'tmp' . $i); |
|
65 | 65 | if ($content === false) { |
66 | - throw new \RuntimeException('Failed to load file '.$this->replyDirectory.'tmp'.$i); |
|
66 | + throw new \RuntimeException('Failed to load file ' . $this->replyDirectory . 'tmp' . $i); |
|
67 | 67 | } |
68 | 68 | $replies[] = $content; |
69 | 69 | $i++; |
@@ -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}?:\d*$/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]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/', $value)) { |
76 | 76 | throw new \InvalidArgumentException('Invalid value "' . $value . '".'); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | public static function getDockerImageWithoutTagValidator(): \Closure |
83 | 83 | { |
84 | - return function (string $value) { |
|
84 | + return function(string $value) { |
|
85 | 85 | $value = trim($value); |
86 | 86 | if (!\preg_match('/^[a-z0-9]+\/([a-z0-9]+(?:[._-][a-z0-9]+)*)$/', $value)) { |
87 | 87 | throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the docker image should be of type "username/repository"'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public static function getDockerImageWithTagValidator(): \Closure |
94 | 94 | { |
95 | - return function (string $value) { |
|
95 | + return function(string $value) { |
|
96 | 96 | $value = trim($value); |
97 | 97 | if (!\preg_match('/^[a-z0-9]+\/([a-z0-9]+(?:[._-][a-z0-9]+)*)(:[\w]+([\w._-]+)?)$/', $value)) { |
98 | 98 | throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the docker image should be of type "username/repository:tag"'); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $validator = $this->validator; |
76 | 76 | |
77 | 77 | if ($this->yesNoQuestion) { |
78 | - $validator = function (?string $response) use ($validator) { |
|
78 | + $validator = function(?string $response) use ($validator) { |
|
79 | 79 | $response = $response ?? ''; |
80 | 80 | $response = \strtolower(trim($response)); |
81 | 81 | if (!\in_array($response, ['y', 'n', 'yes', 'no'], true)) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | if (null !== $this->helpText) { |
90 | - $validator = function (?string $response) use ($validator) { |
|
90 | + $validator = function(?string $response) use ($validator) { |
|
91 | 91 | $response = $response ?? ''; |
92 | 92 | if (trim($response) === '?') { |
93 | 93 | $this->output->writeln($this->helpText ?: ''); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | if ($this->compulsory) { |
101 | - $validator = function (?string $response) use ($validator) { |
|
101 | + $validator = function(?string $response) use ($validator) { |
|
102 | 102 | $response = $response ?? ''; |
103 | 103 | if (trim($response) === '') { |
104 | 104 | throw new \InvalidArgumentException('This field is compulsory.'); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | return $validator ? $validator($response) : $response; |
107 | 107 | }; |
108 | 108 | } else { |
109 | - $validator = function (?string $response) use ($validator) { |
|
109 | + $validator = function(?string $response) use ($validator) { |
|
110 | 110 | $response = $response ?? ''; |
111 | 111 | if (trim($response) === '') { |
112 | 112 | return $response; |
@@ -131,6 +131,6 @@ discard block |
||
131 | 131 | } |
132 | 132 | $this->spacer(); |
133 | 133 | |
134 | - return \is_string($answer)? $answer: (string)$answer; |
|
134 | + return \is_string($answer) ? $answer : (string) $answer; |
|
135 | 135 | } |
136 | 136 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $question = new SymfonyQuestion("Select your $applicationName version [$default]: ", $default); |
61 | 61 | |
62 | 62 | $question->setAutocompleterValues($availableVersions); |
63 | - $question->setValidator(function (string $value) use ($availableVersions, $dockerHubImage) { |
|
63 | + $question->setValidator(function(string $value) use ($availableVersions, $dockerHubImage) { |
|
64 | 64 | $value = trim($value); |
65 | 65 | |
66 | 66 | if ($value === 'v') { |