Completed
Push — master ( 13acd2...446f84 )
by Nils
01:52
created
src/Extensions/SmokeResponseRetriever/Retriever/ListRetriever/Retriever.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                     } else {
50 50
                         $uri = new Uri($url);
51 51
                     }
52
-                    $this->urls[(string)$uri] = ['url' => $uri, 'system' => $key];
52
+                    $this->urls[(string) $uri] = ['url' => $uri, 'system' => $key];
53 53
                 }
54 54
             }
55 55
             $this->urlStack = $this->urls;
@@ -109,20 +109,20 @@  discard block
 block discarded – undo
109 109
                     if (strpos($corruptUrl, '/') === 0) {
110 110
 
111 111
                         $mainUri = $request->getUri();
112
-                        $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri;
112
+                        $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri;
113 113
 
114
-                        $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']];
115
-                        $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']];
114
+                        $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']];
115
+                        $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']];
116 116
 
117 117
                         return $this->next();
118 118
                     }
119 119
 
120 120
                     // the error handling should be done withing the calling class
121
-                    echo "\n   " . $exception->getMessage() . "\n";
121
+                    echo "\n   ".$exception->getMessage()."\n";
122 122
 
123 123
                     return $this->next();
124 124
                 } else {
125
-                    $errorMessages .= $exception->getMessage() . "\n";
125
+                    $errorMessages .= $exception->getMessage()."\n";
126 126
                 }
127 127
             }
128 128
             if ($errorMessages !== '') {
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 
140 140
     public function getOriginUri(UriInterface $uri)
141 141
     {
142
-        if (array_key_exists((string)$uri, $this->redirects)) {
143
-            return $this->urls[$this->redirects[(string)$uri]]['url'];
142
+        if (array_key_exists((string) $uri, $this->redirects)) {
143
+            return $this->urls[$this->redirects[(string) $uri]]['url'];
144 144
         }
145 145
 
146 146
         return $uri;
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 
154 154
     public function getSystem(UriInterface $uri)
155 155
     {
156
-        if (array_key_exists((string)$uri, $this->redirects)) {
157
-            return $this->urls[$this->redirects[(string)$uri]]['system'];
156
+        if (array_key_exists((string) $uri, $this->redirects)) {
157
+            return $this->urls[$this->redirects[(string) $uri]]['system'];
158 158
         }
159 159
 
160
-        return $this->urls[(string)$uri]['system'];
160
+        return $this->urls[(string) $uri]['system'];
161 161
     }
162 162
 
163 163
     public function getSystems()
Please login to merge, or discard this patch.
src/Extensions/SmokeFilter/FilterExtension.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
     public function init($filters = array(), $filterFile = '', $exclusive = array())
43 43
     {
44 44
         if (count($exclusive) > 0 && (count($filters) > 0 || $filterFile !== '')) {
45
-            throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: " . get_class($this) . '].');
45
+            throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: ".get_class($this).'].');
46 46
         }
47 47
 
48 48
         if ($filterFile !== '') {
49 49
             if (!file_exists($filterFile)) {
50
-                throw new \RuntimeException('Filter file not found: ' . $filterFile);
50
+                throw new \RuntimeException('Filter file not found: '.$filterFile);
51 51
             }
52 52
 
53 53
             $filterElements = EnvAwareYaml::parse(file_get_contents($filterFile));
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 if (is_array($urls)) {
73 73
                     foreach ($urls as $url) {
74 74
                         $uri = new Uri($url);
75
-                        $this->exclusives[$rule][] = (string)$uri;
75
+                        $this->exclusives[$rule][] = (string) $uri;
76 76
                     }
77 77
                 }
78 78
             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function isFiltered(Event $event, $ruleName, UriAwareResponse $response)
95 95
     {
96
-        $uri = (string)$this->retriever->getOriginUri($response->getUri());
96
+        $uri = (string) $this->retriever->getOriginUri($response->getUri());
97 97
 
98 98
         if ($this->currentModus === self::MODUS_FILTER) {
99 99
             $isFiltered = $this->isFilteredByFilter($ruleName, $uri);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     private function isFilteredByFilter($ruleName, $uri)
113 113
     {
114 114
         foreach ($this->filters as $filter) {
115
-            if ($ruleName === $filter['rule'] && 0 < preg_match('$' . $filter['uri'] . '$', $uri)) {
115
+            if ($ruleName === $filter['rule'] && 0 < preg_match('$'.$filter['uri'].'$', $uri)) {
116 116
                 return true;
117 117
             }
118 118
         }
Please login to merge, or discard this patch.
src/Rules/Html/RegExExistsRule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
             if ($regEx['isRegEx']) {
43 43
                 $pattern = str_replace('', '\\~', $regEx['pattern']);
44 44
 
45
-                if (preg_match('~' . $pattern . '~', (string)$response->getBody()) === 0) {
46
-                    $errors[] = 'Regular expression: ' . $regEx['pattern'];
45
+                if (preg_match('~'.$pattern.'~', (string) $response->getBody()) === 0) {
46
+                    $errors[] = 'Regular expression: '.$regEx['pattern'];
47 47
                 }
48 48
             } else {
49
-                if (preg_match('^' . preg_quote($regEx['pattern']) . '^', (string)$response->getBody()) === 0) {
50
-                    $errors[] = 'Text: ' . $regEx['pattern'];
49
+                if (preg_match('^'.preg_quote($regEx['pattern']).'^', (string) $response->getBody()) === 0) {
50
+                    $errors[] = 'Text: '.$regEx['pattern'];
51 51
                 }
52 52
             }
53 53
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $errorString = 'The following text elements were not found: <ul>';
57 57
 
58 58
             foreach ($errors as $error) {
59
-                $errorString .= '<li>' . $error . '</li>';
59
+                $errorString .= '<li>'.$error.'</li>';
60 60
             }
61 61
 
62 62
             $errorString .= '</ul>';
Please login to merge, or discard this patch.
src/Rules/Html/ClosingHtmlTagRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     {
17 17
         if ($response instanceof ContentTypeAwareResponse) {
18 18
             if (($response->getStatusCode() < 300 || $response->getStatusCode() >= 400) && $response->getContentType() === 'text/html') {
19
-                if (stripos((string)$response->getBody(), '</html>') === false) {
20
-                    throw new ValidationFailedException('Closing html tag is missing (document length: ' . strlen((string)$response->getBody()) . ').');
19
+                if (stripos((string) $response->getBody(), '</html>') === false) {
20
+                    throw new ValidationFailedException('Closing html tag is missing (document length: '.strlen((string) $response->getBody()).').');
21 21
                 }
22 22
             }
23 23
         }
Please login to merge, or discard this patch.
src/Extensions/SmokeMemory/MemoryExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         foreach ($results as $result) {
36 36
             /** @var UriAwareResponse $response */
37 37
             if ($result->getStatus() == CheckResult::STATUS_FAILURE) {
38
-                $this->memory[] = (string)$response->getUri();
38
+                $this->memory[] = (string) $response->getUri();
39 39
             }
40 40
         }
41 41
     }
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/LeankoalaReporter.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         foreach ($this->results as $results) {
127 127
             foreach ($results as $result) {
128 128
                 /* @var CheckResult $result */
129
-                $tool = 'Smoke' . $result->getRuleName();
129
+                $tool = 'Smoke'.$result->getRuleName();
130 130
                 $checks[$tool][] = $result;
131 131
             }
132 132
         }
@@ -138,19 +138,19 @@  discard block
 block discarded – undo
138 138
                 continue;
139 139
             }
140 140
 
141
-            $message = 'The smoke test for #system_name# failed (Rule: ' . $toolName . ').<ul>';
141
+            $message = 'The smoke test for #system_name# failed (Rule: '.$toolName.').<ul>';
142 142
             $status = Event::STATUS_SUCCESS;
143 143
             $failureCount = 0;
144
-            $identifier = $toolName . '_' . $this->system;
144
+            $identifier = $toolName.'_'.$this->system;
145 145
 
146 146
             foreach ($results as $result) {
147 147
                 /** @var CheckResult $result */
148 148
                 if ($result->getStatus() === CheckResult::STATUS_FAILURE) {
149 149
                     $comingFrom = '';
150 150
                     if ($this->addComingFrom && $this->retriever->getComingFrom($result->getResponse()->getUri())) {
151
-                        $comingFrom = ', coming from: ' . $this->retriever->getComingFrom($result->getResponse()->getUri());
151
+                        $comingFrom = ', coming from: '.$this->retriever->getComingFrom($result->getResponse()->getUri());
152 152
                     }
153
-                    $message .= '<li>' . $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . $comingFrom . ')</li>';
153
+                    $message .= '<li>'.$result->getMessage().' (url: '.(string) $result->getResponse()->getUri().$comingFrom.')</li>';
154 154
                     ++$failureCount;
155 155
                 }
156 156
             }
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
                 $status = Event::STATUS_FAILURE;
159 159
                 $message .= '</ul>';
160 160
                 $firstResult = array_pop($results);
161
-                $attributes[] = new Attribute('html-content', (string)$firstResult->getResponse()->getBody(), true);
161
+                $attributes[] = new Attribute('html-content', (string) $firstResult->getResponse()->getBody(), true);
162 162
             } else {
163
-                $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:' . $toolName . '].';
163
+                $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:'.$toolName.'].';
164 164
             }
165 165
 
166 166
             $this->send($identifier, $this->system, $message, $status, $failureCount, $this->tool, $this->system, $attributes);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             foreach ($results as $result) {
174 174
                 /* @var CheckResult $result */
175 175
 
176
-                $identifier = '_' . $this->getIdentifier($result);
176
+                $identifier = '_'.$this->getIdentifier($result);
177 177
                 $tool = $this->getPrefix($result->getRuleName());
178 178
 
179 179
                 $component = $this->getComponent($result->getRuleName());
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
                 $attributes = array();
183 183
                 if ($result->getStatus() == CheckResult::STATUS_FAILURE) {
184
-                    $body = (string)$result->getResponse()->getBody();
184
+                    $body = (string) $result->getResponse()->getBody();
185 185
                     if ($body == "") {
186 186
                         $attributes[] = new Attribute('html content', '<empty>');
187 187
                     } else {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                 $this->send(
206 206
                     $identifier,
207 207
                     $currentSystem,
208
-                    $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . ')',
208
+                    $result->getMessage().' (url: '.(string) $result->getResponse()->getUri().')',
209 209
                     $result->getStatus(),
210 210
                     $result->getValue(),
211 211
                     $tool,
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
     private function getIdentifier(CheckResult $result)
220 220
     {
221 221
         if ($this->useUrlAsIdentifier) {
222
-            $suffix = '_' . md5((string)$result->getResponse()->getUri());
222
+            $suffix = '_'.md5((string) $result->getResponse()->getUri());
223 223
         } else {
224 224
             $suffix = '';
225 225
         }
226 226
 
227
-        return $this->tool . '_' . $result->getRuleName() . $suffix;
227
+        return $this->tool.'_'.$result->getRuleName().$suffix;
228 228
     }
229 229
 
230 230
     private function getPrefix($string)
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
                 $this->reporter->sendEvent($event);
256 256
             } catch (KoalamonException $e) {
257 257
                 $this->output->writeln("\n  <error> Error sending result to leankoala. </error>");
258
-                $this->output->writeln('   Url: ' . $e->getUrl());
259
-                $this->output->writeln('   Payload: ' . $e->getPayload());
258
+                $this->output->writeln('   Url: '.$e->getUrl());
259
+                $this->output->writeln('   Payload: '.$e->getPayload());
260 260
                 $this->output->writeln("");
261 261
             } catch (\Exception $e) {
262 262
                 $this->output->writeln($e->getMessage());
Please login to merge, or discard this patch.
src/Rules/Http/RedirectRule.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@
 block discarded – undo
31 31
             $uri = new Uri($url['url']);
32 32
 
33 33
             $urlResponses = $client->sendRequests([new Request('GET', $uri)]);
34
-            $effectiveUrl = (string)$urlResponses[0]->getEffectiveUri();
34
+            $effectiveUrl = (string) $urlResponses[0]->getEffectiveUri();
35 35
 
36
-            if ($effectiveUrl != (string)$response->getUri()) {
37
-                $errors[] = 'The url "' . $url['url'] . '" gets redirected to "' . $effectiveUrl . '".';
36
+            if ($effectiveUrl != (string) $response->getUri()) {
37
+                $errors[] = 'The url "'.$url['url'].'" gets redirected to "'.$effectiveUrl.'".';
38 38
             }
39 39
         }
40 40
 
41 41
         if (count($errors) > 0) {
42
-            $message = 'Not all given urls do redirect to "' . (string)$response->getUri() . '"".<ul>';
42
+            $message = 'Not all given urls do redirect to "'.(string) $response->getUri().'"".<ul>';
43 43
             foreach ($errors as $error) {
44
-                $message .= '<li>' . $error . '</li>';
44
+                $message .= '<li>'.$error.'</li>';
45 45
             }
46 46
             $message .= "</ul>";
47 47
 
48 48
             return new CheckResult(CheckResult::STATUS_FAILURE, $message);
49 49
         } else {
50
-            return new CheckResult(CheckResult::STATUS_SUCCESS, 'All given urls redirect to ' . (string)$response->getUri());
50
+            return new CheckResult(CheckResult::STATUS_SUCCESS, 'All given urls redirect to '.(string) $response->getUri());
51 51
         }
52 52
     }
53 53
 }
Please login to merge, or discard this patch.