Completed
Pull Request — master (#104)
by David
04:40
created
src/Yaml/Dumper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         if ($input instanceof CommentedItem) {
65 65
             //$comment = $input->getComment();
66
-            $output = '# '.$input->getComment()."\n";
66
+            $output = '# ' . $input->getComment() . "\n";
67 67
             $input = $input->getItem();
68 68
         } else {
69 69
             //$comment = null;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         }
80 80
 
81 81
         if ($inline <= 0 || (!\is_array($input) && $dumpObjectAsInlineMap) || empty($input)) {
82
-            $output .= $prefix.Inline::dump($input, $flags);
82
+            $output .= $prefix . Inline::dump($input, $flags);
83 83
         } else {
84 84
             $dumpAsMap = Inline::isHash($input);
85 85
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                     // If the first line starts with a space character, the spec requires a blockIndicationIndicator
96 96
                     // http://www.yaml.org/spec/1.2/spec.html#id2793979
97 97
                     $blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
98
-                    $output .= sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator);
98
+                    $output .= sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', '', $blockIndentationIndicator);
99 99
 
100 100
                     $pregSplit = preg_split('/\n|\r\n/', $value);
101 101
                     foreach ($pregSplit as $row) {
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
                 $output .= sprintf(
120 120
                     '%s%s%s%s',
121 121
                     $prefix,
122
-                    $dumpAsMap ? Inline::dump($key, $flags).':' : '-',
122
+                    $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-',
123 123
                     $willBeInlined ? ' ' : "\n",
124 124
                     $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)
125
-                ).($willBeInlined ? "\n" : '');
125
+                ) . ($willBeInlined ? "\n" : '');
126 126
             }
127 127
         }
128 128
 
Please login to merge, or discard this patch.
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/Question/CommonValidators.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public static function getAlphaValidator(?array $additionalCharacters = null, ?string $hint = null): \Closure
15 15
     {
16
-        return function (string $value) use ($additionalCharacters, $hint) {
16
+        return function(string $value) use ($additionalCharacters, $hint) {
17 17
             $value = trim($value);
18 18
             $pattern = '/^[a-zA-Z0-9';
19 19
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public static function getAbsolutePathValidator(): \Closure
41 41
     {
42
-        return function (string $value) {
42
+        return function(string $value) {
43 43
             $value = trim($value);
44 44
             if (!preg_match('/^[\'"]?(?:\/[^\/\n]+)*[\'"]?$/', $value)) {
45 45
                 throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: path has to be absolute without trailing "/".');
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     public static function getDomainNameValidator(): \Closure
52 52
     {
53
-        return function (string $value) {
53
+        return function(string $value) {
54 54
             $value = trim($value);
55 55
             if (!preg_match('/^(?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?$/im', $value)) {
56 56
                 throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the domain name must not start with "http(s)://".');
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public static function getDomainNameWithPortValidator(): \Closure
63 63
     {
64
-        return function (string $value) {
64
+        return function(string $value) {
65 65
             $value = trim($value);
66 66
             if (!preg_match('/^(?!:\/\/)([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\.[a-zA-Z]{2,11}?:\d*$/im', $value)) {
67 67
                 throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the domain name must not start with "http(s)://".');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
     public static function getIPv4Validator(): \Closure
74 74
     {
75
-        return function (string $value) {
75
+        return function(string $value) {
76 76
             $value = trim($value);
77 77
             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)) {
78 78
                 throw new \InvalidArgumentException('Invalid value "' . $value . '".');
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
     public static function getDockerImageWithoutTagValidator(): \Closure
85 85
     {
86
-        return function (string $value) {
86
+        return function(string $value) {
87 87
             $value = trim($value);
88 88
             if (!preg_match('/^[a-z0-9]+\/([a-z0-9]+(?:[._-][a-z0-9]+)*)$/', $value)) {
89 89
                 throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the docker image should be of type "username/repository"');
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
     public static function getDockerImageWithTagValidator(): \Closure
96 96
     {
97
-        return function (string $value) {
97
+        return function(string $value) {
98 98
             $value = trim($value);
99 99
             if (!preg_match('/^[a-z0-9]+\/([a-z0-9]+(?:[._-][a-z0-9]+)*)(:[\w]+([\w._-]+)?)$/', $value)) {
100 100
                 throw new \InvalidArgumentException('Invalid value "' . $value . '". Hint: the docker image should be of type "username/repository:tag"');
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/Helper/ReplyAggregator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
     public function __construct(string $replyDirectory = null)
21 21
     {
22 22
         if ($replyDirectory === null) {
23
-            $replyDirectory = \sys_get_temp_dir().'/replies';
23
+            $replyDirectory = \sys_get_temp_dir() . '/replies';
24 24
         }
25
-        $this->replyDirectory = rtrim($replyDirectory, '/').'/';
25
+        $this->replyDirectory = rtrim($replyDirectory, '/') . '/';
26 26
         if (!\file_exists($replyDirectory)) {
27 27
             mkdir($replyDirectory, 0777, true);
28 28
         }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function clear(): void
35 35
     {
36
-        $files = glob($this->replyDirectory.'*'); // get all file names
36
+        $files = glob($this->replyDirectory . '*'); // get all file names
37 37
         foreach ($files as $file) { // iterate files
38 38
             if (is_file($file)) {
39 39
                 unlink($file); // delete file
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
     private function getNextFileName(): string
45 45
     {
46 46
         $i = 0;
47
-        while (\file_exists($this->replyDirectory.'tmp'.$i)) {
47
+        while (\file_exists($this->replyDirectory . 'tmp' . $i)) {
48 48
             $i++;
49 49
         }
50
-        return 'tmp'.$i;
50
+        return 'tmp' . $i;
51 51
     }
52 52
 
53 53
     public function storeReply(string $payload): void
54 54
     {
55
-        $path = $this->replyDirectory.$this->getNextFileName();
55
+        $path = $this->replyDirectory . $this->getNextFileName();
56 56
         \file_put_contents($path, $payload);
57 57
     }
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $i = 0;
65 65
         $replies = [];
66
-        while (\file_exists($this->replyDirectory.'tmp'.$i)) {
67
-            $content = file_get_contents($this->replyDirectory.'tmp'.$i);
66
+        while (\file_exists($this->replyDirectory . 'tmp' . $i)) {
67
+            $content = file_get_contents($this->replyDirectory . 'tmp' . $i);
68 68
             $replies[] = $content;
69 69
             $i++;
70 70
         }
Please login to merge, or discard this patch.