Completed
Push — master ( 36a3c8...68e352 )
by Julien
05:44 queued 03:12
created
src/Registry/TagsAnalyzer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     public function filterBestTags(array $tags): array
22 22
     {
23 23
         // filter numeric versions only
24
-        $versions = \array_filter($tags, function (string $tag) {
24
+        $versions = \array_filter($tags, function(string $tag) {
25 25
             return preg_match('/^\d+(\.\d+)*$/', $tag);
26 26
         });
27 27
 
Please login to merge, or discard this patch.
src/Service/Service.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -131,13 +131,12 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function jsonSerialize(): array
133 133
     {
134
-        $labelMap = function (CommentedItem $commentedItem): array {
134
+        $labelMap = function(CommentedItem $commentedItem): array {
135 135
             return null === $commentedItem->getComment() ?
136
-                ['value' => $commentedItem->getItem()] :
137
-                ['value' => $commentedItem->getItem(), 'comment' => $commentedItem->getComment()];
136
+                ['value' => $commentedItem->getItem()] : ['value' => $commentedItem->getItem(), 'comment' => $commentedItem->getComment()];
138 137
         };
139 138
 
140
-        $jsonSerializeMap = function (\JsonSerializable $obj): array {
139
+        $jsonSerializeMap = function(\JsonSerializable $obj): array {
141 140
             return $obj->jsonSerialize();
142 141
         };
143 142
 
@@ -172,13 +171,13 @@  discard block
 block discarded – undo
172 171
             'requests' => array_filter([
173 172
                 'memory' => $this->requestMemory,
174 173
                 'cpu' => $this->requestCpu,
175
-            ], function ($v) {
174
+            ], function($v) {
176 175
                 return null !== $v;
177 176
             }),
178 177
             'limits' => array_filter([
179 178
                 'memory' => $this->limitMemory,
180 179
                 'cpu' => $this->limitCpu,
181
-            ], function ($v) {
180
+            ], function($v) {
182 181
                 return null !== $v;
183 182
             }),
184 183
         ]);
@@ -416,7 +415,7 @@  discard block
 block discarded – undo
416 415
             'source' => $source,
417 416
             'target' => $target,
418 417
             'comment' => $comment,
419
-        ], function ($v) {
418
+        ], function($v) {
420 419
             return null !== $v;
421 420
         });
422 421
     }
@@ -590,7 +589,7 @@  discard block
 block discarded – undo
590 589
 
591 590
     private function removeVolumesByType(string $type): void
592 591
     {
593
-        $filterFunction = function (Volume $vol) use ($type) {
592
+        $filterFunction = function(Volume $vol) use ($type) {
594 593
             return $vol->getType() !== $type;
595 594
         };
596 595
         $this->volumes = array_values(array_filter($this->volumes, $filterFunction));
@@ -613,7 +612,7 @@  discard block
 block discarded – undo
613 612
 
614 613
     public function removeVolumesBySource(string $source): void
615 614
     {
616
-        $filterFunction = function (Volume $vol) use ($source) {
615
+        $filterFunction = function(Volume $vol) use ($source) {
617 616
             return $vol->getSource() !== $source;
618 617
         };
619 618
         $this->volumes = array_values(array_filter($this->volumes, $filterFunction));
Please login to merge, or discard this patch.
src/Aenthill/Aenthill.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@
 block discarded – undo
158 158
             throw new \RuntimeException('Payload object should implement JsonSerializable. Got an instance of ' . \get_class($payload));
159 159
         }
160 160
         $replies = self::dispatch($event, \GuzzleHttp\json_encode($payload), $filters);
161
-        return \array_map(function (string $reply) {
161
+        return \array_map(function(string $reply) {
162 162
             return \GuzzleHttp\json_decode($reply, true);
163 163
         }, $replies);
164 164
     }
Please login to merge, or discard this patch.
src/Helper/ReplyAggregator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
     public function __construct(string $replyDirectory = null)
31 31
     {
32 32
         if ($replyDirectory === null) {
33
-            $replyDirectory = \sys_get_temp_dir().'/replies';
33
+            $replyDirectory = \sys_get_temp_dir() . '/replies';
34 34
         }
35
-        $this->replyDirectory = rtrim($replyDirectory, '/').'/';
35
+        $this->replyDirectory = rtrim($replyDirectory, '/') . '/';
36 36
         if (!\file_exists($replyDirectory)) {
37 37
             mkdir($replyDirectory, 0777, true);
38 38
             if (!is_dir($replyDirectory)) {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function clear(): void
49 49
     {
50
-        $files = glob($this->replyDirectory.'*'); // get all file names
50
+        $files = glob($this->replyDirectory . '*'); // get all file names
51 51
         foreach ($files as $file) { // iterate files
52 52
             if (is_file($file)) {
53 53
                 unlink($file); // delete file
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
     private function getNextFileName(): string
59 59
     {
60 60
         $i = 0;
61
-        while (\file_exists($this->replyDirectory.'tmp'.$i)) {
61
+        while (\file_exists($this->replyDirectory . 'tmp' . $i)) {
62 62
             $i++;
63 63
         }
64
-        return 'tmp'.$i;
64
+        return 'tmp' . $i;
65 65
     }
66 66
 
67 67
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function storeReply(string $payload): void
72 72
     {
73
-        $path = $this->replyDirectory.$this->getNextFileName();
73
+        $path = $this->replyDirectory . $this->getNextFileName();
74 74
         file_put_contents($path, $payload);
75 75
     }
76 76
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $i = 0;
84 84
         $replies = [];
85
-        while (\file_exists($this->replyDirectory.'tmp'.$i)) {
86
-            $content = file_get_contents($this->replyDirectory.'tmp'.$i);
85
+        while (\file_exists($this->replyDirectory . 'tmp' . $i)) {
86
+            $content = file_get_contents($this->replyDirectory . 'tmp' . $i);
87 87
             if ($content === false) {
88
-                throw new \RuntimeException('Failed to load file '.$this->replyDirectory.'tmp'.$i);
88
+                throw new \RuntimeException('Failed to load file ' . $this->replyDirectory . 'tmp' . $i);
89 89
             }
90 90
             $replies[] = $content;
91 91
             $i++;
Please login to merge, or discard this patch.
src/Prompt/AbstractInput.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     private function getHelpTextValidator(?callable $else): ?callable
66 66
     {
67 67
         if (!empty($this->helpText)) {
68
-            return function (?string $response) use ($else) {
68
+            return function(?string $response) use ($else) {
69 69
                 $response = $response ?? '';
70 70
                 if (\trim($response) === '?') {
71 71
                     $this->output->writeln($this->helpText ?: '');
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     private function getCompulsoryValidator(?callable $else): ?callable
85 85
     {
86 86
         if ($this->compulsory && empty($this->default)) {
87
-            return function (?string $response) {
87
+            return function(?string $response) {
88 88
                 $response = $response ?? '';
89 89
                 if (\trim($response) === '') {
90 90
                     throw new \InvalidArgumentException('Hey, this field is compulsory!');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 return !empty($else) ? $else($response) : $response;
93 93
             };
94 94
         }
95
-        return function (?string $response) use ($else) {
95
+        return function(?string $response) use ($else) {
96 96
             $response = $response ?? '';
97 97
             if (\trim($response) === '') {
98 98
                 return $response;
Please login to merge, or discard this patch.
src/Prompt/Confirm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      */
45 45
     private function boolValidator(): ?callable
46 46
     {
47
-        return function (?string $response) {
47
+        return function(?string $response) {
48 48
             $response = $response ?? '';
49 49
             $response = \strtolower(trim($response));
50 50
             if (!\in_array($response, ['y', 'n', 'yes', 'no'], true)) {
Please login to merge, or discard this patch.
src/Prompt/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@
 block discarded – undo
49 49
         $choices = $this->items;
50 50
         $multiselect = $this->multiselect;
51 51
         $errorMessage = 'Value "%s" is invalid';
52
-        $isAssoc = (bool)\count(\array_filter(\array_keys($choices), '\is_string'));
52
+        $isAssoc = (bool) \count(\array_filter(\array_keys($choices), '\is_string'));
53 53
 
54
-        return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
54
+        return function($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
55 55
             // Collapse all spaces.
56 56
             $selectedChoices = \str_replace(' ', '', $selected);
57 57
             if (!empty($this->helpText) && $selectedChoices === '?') {
Please login to merge, or discard this patch.
src/Prompt/Helper/ValidatorHelper.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public static function merge(?callable $v1, ?callable $v2): callable
21 21
     {
22
-        return function (?string $response) use ($v1, $v2) {
22
+        return function(?string $response) use ($v1, $v2) {
23 23
             if (!empty($v1)) {
24 24
                 $response = $v1($response);
25 25
             }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public static function getFuncShouldReturnTrueValidator(callable $func, ?string $errorMessage = null): callable
39 39
     {
40
-        return function (string $response) use ($func, $errorMessage) {
40
+        return function(string $response) use ($func, $errorMessage) {
41 41
             $response = \trim($response);
42 42
             $message = sprintf((!empty($errorMessage) ? $errorMessage : self::DEFAULT_ERROR_MESSAGE), $response);
43 43
             if (!$func($response)) {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public static function getFuncShouldNotReturnTrueValidator(callable $func, ?string $errorMessage = null): callable
56 56
     {
57
-        return function (string $response) use ($func, $errorMessage) {
57
+        return function(string $response) use ($func, $errorMessage) {
58 58
             $response = \trim($response);
59 59
             $message = sprintf((!empty($errorMessage) ? $errorMessage : self::DEFAULT_ERROR_MESSAGE), $response);
60 60
             if ($func($response)) {
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public static function getAlphaValidator(?string $errorMessage = null): callable
72 72
     {
73
-        return function (string $response) use ($errorMessage) {
73
+        return function(string $response) use ($errorMessage) {
74 74
             $response = \trim($response);
75 75
             $pattern = '/^[a-zA-Z0-9]+$/';
76 76
             if (!preg_match($pattern, $response)) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public static function getAlphaWithAdditionalCharactersValidator(array $additionalCharacters, ?string $errorMessage = null): callable
90 90
     {
91
-        return function (string $response) use ($additionalCharacters, $errorMessage) {
91
+        return function(string $response) use ($additionalCharacters, $errorMessage) {
92 92
             $response = \trim($response);
93 93
             $pattern = '/^[a-zA-Z0-9';
94 94
             foreach ($additionalCharacters as $character) {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public static function getDomainNameValidator(?string $errorMessage = null): callable
111 111
     {
112
-        return function (string $response) use ($errorMessage) {
112
+        return function(string $response) use ($errorMessage) {
113 113
             $response = trim($response);
114 114
             if (!preg_match('/^(?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?$/im', $response)) {
115 115
                 $message = sprintf((!empty($errorMessage) ? $errorMessage : self::DEFAULT_ERROR_MESSAGE . '. Hint: the domain name must not start with "http(s)://".'), $response);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public static function getDomainNameWithPortValidator(?string $errorMessage = null): callable
127 127
     {
128
-        return function (string $response) use ($errorMessage) {
128
+        return function(string $response) use ($errorMessage) {
129 129
             $response = trim($response);
130 130
             if (!preg_match('/^(?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?(:\d*)?$/im', $response)) {
131 131
                 $message = sprintf((!empty($errorMessage) ? $errorMessage : self::DEFAULT_ERROR_MESSAGE . '. Hint: the domain name must not start with "http(s)://".'), $response);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      */
141 141
     public static function getDockerImageWithoutTagValidator(): callable
142 142
     {
143
-        return function (string $response) {
143
+        return function(string $response) {
144 144
             $response = \trim($response);
145 145
             if (!preg_match('/^[a-z0-9]+\/([a-z0-9]+(?:[._-][a-z0-9]+)*)$/', $response)) {
146 146
                 $message = sprintf(self::DEFAULT_ERROR_MESSAGE . '. Hint: the docker image should be of type "username/repository"', $response);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public static function getIPv4Validator(?string $errorMessage = null): callable
164 164
     {
165
-        return function (string $response) use ($errorMessage) {
165
+        return function(string $response) use ($errorMessage) {
166 166
             $response = \trim($response);
167 167
             if (!preg_match('/^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/', $response)) {
168 168
                 $message = sprintf((!empty($errorMessage) ? $errorMessage : self::DEFAULT_ERROR_MESSAGE), $response);
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public static function getAbsolutePathValidator(?string $errorMessage = null): callable
180 180
     {
181
-        return function (string $response) use ($errorMessage) {
181
+        return function(string $response) use ($errorMessage) {
182 182
             $response = \trim($response);
183 183
             if (!preg_match('/^[\'"]?(?:\/[^\/\n]+)*[\'"]?$/', $response)) {
184 184
                 $message = sprintf((!empty($errorMessage) ? $errorMessage : self::DEFAULT_ERROR_MESSAGE . '". Hint: path has to be absolute without trailing "/".'), $response);
Please login to merge, or discard this patch.
src/Prompt/Helper/PromptHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $this->output->writeln('Enter "v" to view all available versions, "?" for help.');
117 117
         $question = new Question("Version [$default]: ", $default);
118 118
         $question->setAutocompleterValues($tags);
119
-        $question->setValidator(function (string $response) use ($tags, $image) {
119
+        $question->setValidator(function(string $response) use ($tags, $image) {
120 120
             $response = \trim($response);
121 121
             if ($response === 'v') {
122 122
                 $this->output->writeln('Available versions: <info>' . \implode('</info>, <info>', $tags) . '</info>');
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
             ->setText($text)
170 170
             ->setHelpText($helpText)
171 171
             ->setCompulsory(true)
172
-            ->setValidator(function (string $dir) {
172
+            ->setValidator(function(string $dir) {
173 173
                 $dir = trim($dir, '/') ?: '.';
174 174
                 $rootDir = Pheromone::getContainerProjectDirectory();
175
-                $fullDir = $rootDir.'/'.$dir;
175
+                $fullDir = $rootDir . '/' . $dir;
176 176
                 if (!file_exists($fullDir)) {
177 177
                     mkdir($fullDir);
178 178
                     $containerProjectDirInfo = new \SplFileInfo(\dirname($fullDir));
Please login to merge, or discard this patch.