Completed
Push — master ( 6da510...33a55e )
by Nils
05:34
created
src/Rules/Json/JsonSchema/JsonSchemaRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $data = json_decode($response->getBody());
36 36
         if ($data === null) {
37
-            throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "').");
37
+            throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."').");
38 38
         } else {
39 39
             $errorStatus = false;
40 40
             $messageParts = array();
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
                     $errorStatus = true;
51 51
                     $errorMessage = '';
52 52
                     foreach ($validator->getErrors() as $error) {
53
-                        $errorMessage = $errorMessage . sprintf("[%s] %s\n", $error['property'], $error['message']);
53
+                        $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']);
54 54
                     }
55
-                    $messageParts[] = $jsonSchemaFile['jsonfilename'] . ' - ' . $jsonSchemaFile['jsonfileurl'] . '(last error: ' . $errorMessage . ').';
55
+                    $messageParts[] = $jsonSchemaFile['jsonfilename'].' - '.$jsonSchemaFile['jsonfileurl'].'(last error: '.$errorMessage.').';
56 56
                 }
57 57
             }
58 58
 
59 59
             if ($errorStatus === true) {
60
-                $message = 'JSON file (' . (string) $response->getUri() . ')  does not validate against the following JSON Schema files: ' . implode(', ', $messageParts);
60
+                $message = 'JSON file ('.(string) $response->getUri().')  does not validate against the following JSON Schema files: '.implode(', ', $messageParts);
61 61
                 throw new ValidationFailedException($message);
62 62
             }
63 63
         }
Please login to merge, or discard this patch.
src/Rules/Html/CssSelectorExistsRule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function doValidation(Response $response)
25 25
     {
26 26
         $domDocument = new \DOMDocument();
27
-        @$domDocument->loadHTML((string)$response->getBody());
27
+        @$domDocument->loadHTML((string) $response->getBody());
28 28
 
29 29
         $domXPath = new \DOMXPath($domDocument);
30 30
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             try {
38 38
                 $selectorAsXPath = $converter->toXPath($selector['pattern']);
39 39
             } catch (\Exception $e) {
40
-                throw new ValidationFailedException('Invalid css selector (' . $selector['pattern'] . ').');
40
+                throw new ValidationFailedException('Invalid css selector ('.$selector['pattern'].').');
41 41
             }
42 42
 
43 43
             $count = $domXPath->query($selectorAsXPath)->length;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         if ($error === true) {
52 52
             $allNotFoundSelectors = implode('", "', $snotFoundSelectors);
53 53
 
54
-            throw new ValidationFailedException('CSS Selector "' . $allNotFoundSelectors . '" not found in DOM.');
54
+            throw new ValidationFailedException('CSS Selector "'.$allNotFoundSelectors.'" not found in DOM.');
55 55
         }
56 56
     }
57 57
 }
Please login to merge, or discard this patch.
src/Scanner/Scanner.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
             } catch (ValidationFailedException $e) {
97 97
                 $result = new CheckResult(CheckResult::STATUS_FAILURE, $e->getMessage());
98 98
             } catch (\Exception $e) {
99
-                $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occured: ' . $e->getMessage());
99
+                $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occured: '.$e->getMessage());
100 100
             }
101 101
 
102 102
             $result->setResponse($response);
Please login to merge, or discard this patch.
src/Extensions/SmokeResponseRetriever/Retriever/ListRetriever/Retriever.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         if ($url['url'] instanceof UriInterface) {
93 93
             $urlObject = $url['url'];
94
-        }else {
94
+        } else {
95 95
             $urlObject = new Uri($url['url']);
96 96
         }
97 97
 
@@ -112,20 +112,20 @@  discard block
 block discarded – undo
112 112
                         /* @var \Ivory\HttpAdapter\HttpAdapterException $exception */
113 113
 
114 114
                         $mainUri = $request->getUri();
115
-                        $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri;
115
+                        $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri;
116 116
 
117
-                        $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']];
118
-                        $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']];
117
+                        $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']];
118
+                        $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']];
119 119
 
120 120
                         return $this->next();
121 121
                     }
122 122
 
123 123
                     // the error handling should be done withing the calling class
124
-                    echo "\n   " . $exception->getMessage() . "\n";
124
+                    echo "\n   ".$exception->getMessage()."\n";
125 125
 
126 126
                     return $this->next();
127 127
                 } else {
128
-                    $errorMessages .= $exception->getMessage() . "\n";
128
+                    $errorMessages .= $exception->getMessage()."\n";
129 129
                 }
130 130
             }
131 131
             if ($errorMessages !== '') {
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 
139 139
     public function getOriginUri(UriInterface $uri)
140 140
     {
141
-        if (array_key_exists((string)$uri, $this->redirects)) {
142
-            return $this->urls[$this->redirects[(string)$uri]]['url'];
141
+        if (array_key_exists((string) $uri, $this->redirects)) {
142
+            return $this->urls[$this->redirects[(string) $uri]]['url'];
143 143
         }
144 144
 
145 145
         return $uri;
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 
153 153
     public function getSystem(UriInterface $uri)
154 154
     {
155
-        if (array_key_exists((string)$uri, $this->redirects)) {
156
-            return $this->urls[$this->redirects[(string)$uri]]['system'];
155
+        if (array_key_exists((string) $uri, $this->redirects)) {
156
+            return $this->urls[$this->redirects[(string) $uri]]['system'];
157 157
         }
158 158
 
159
-        return $this->urls[(string)$uri]['system'];
159
+        return $this->urls[(string) $uri]['system'];
160 160
     }
161 161
 
162 162
     public function getSystems()
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
 
92 92
         if ($url['url'] instanceof UriInterface) {
93 93
             $urlObject = $url['url'];
94
-        }else {
94
+        } else {
95 95
             $urlObject = new Uri($url['url']);
96 96
         }
97 97
 
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/LeankoalaReporter.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -198,12 +198,12 @@
 block discarded – undo
198 198
     }
199 199
 
200 200
     /**
201
-     * @param $identifier
201
+     * @param string $identifier
202 202
      * @param $system
203
-     * @param $message
203
+     * @param string $message
204 204
      * @param $status
205 205
      * @param $value
206
-     * @param $tool
206
+     * @param string $tool
207 207
      * @param $component
208 208
      * @param Attribute[] $attributes
209 209
      */
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         foreach ($this->results as $results) {
119 119
             foreach ($results as $result) {
120 120
                 /* @var CheckResult $result */
121
-                $tool = 'Smoke' . $result->getRuleName();
121
+                $tool = 'Smoke'.$result->getRuleName();
122 122
                 $checks[$tool][] = $result;
123 123
             }
124 124
         }
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
                 continue;
131 131
             }
132 132
 
133
-            $message = 'The smoke test for #system_name# failed (Rule: ' . $toolName . ').<ul>';
133
+            $message = 'The smoke test for #system_name# failed (Rule: '.$toolName.').<ul>';
134 134
             $status = Event::STATUS_SUCCESS;
135 135
             $failureCount = 0;
136
-            $identifier = $toolName . '_' . $this->system;
136
+            $identifier = $toolName.'_'.$this->system;
137 137
 
138 138
             foreach ($results as $result) {
139 139
                 /** @var CheckResult $result */
140 140
                 if ($result->getStatus() === CheckResult::STATUS_FAILURE) {
141 141
                     $comingFrom = '';
142 142
                     if ($this->addComingFrom && $this->retriever->getComingFrom($result->getResponse()->getUri())) {
143
-                        $comingFrom = ', coming from: ' . $this->retriever->getComingFrom($result->getResponse()->getUri());
143
+                        $comingFrom = ', coming from: '.$this->retriever->getComingFrom($result->getResponse()->getUri());
144 144
                     }
145
-                    $message .= '<li>' . $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . $comingFrom . ')</li>';
145
+                    $message .= '<li>'.$result->getMessage().' (url: '.(string) $result->getResponse()->getUri().$comingFrom.')</li>';
146 146
                     ++$failureCount;
147 147
                 }
148 148
             }
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
                 $status = Event::STATUS_FAILURE;
151 151
                 $message .= '</ul>';
152 152
                 $firstResult = array_pop($results);
153
-                $attributes[] = new Attribute('html-content', (string)$firstResult->getResponse()->getBody(), true);
153
+                $attributes[] = new Attribute('html-content', (string) $firstResult->getResponse()->getBody(), true);
154 154
             } else {
155
-                $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:' . $toolName . '].';
155
+                $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:'.$toolName.'].';
156 156
             }
157 157
 
158 158
             $this->send($identifier, $this->system, $message, $status, $failureCount, $this->tool, $this->system, $attributes);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             foreach ($results as $result) {
166 166
                 /* @var CheckResult $result */
167 167
 
168
-                $identifier = '_' . $this->getIdentifier($result);
168
+                $identifier = '_'.$this->getIdentifier($result);
169 169
                 $tool = $this->getPrefix($result->getRuleName());
170 170
 
171 171
                 $component = $this->getComponent($result->getRuleName());
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
                 $attributes = array();
175 175
                 if ($result->getStatus() == CheckResult::STATUS_FAILURE) {
176
-                    $attributes[] = new Attribute('html content', (string)$result->getResponse()->getBody(), true);
176
+                    $attributes[] = new Attribute('html content', (string) $result->getResponse()->getBody(), true);
177 177
                     $attributes[] = new Attribute('http status code', $result->getResponse()->getStatusCode());
178 178
                 }
179 179
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                 $this->send(
192 192
                     $identifier,
193 193
                     $currentSystem,
194
-                    $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . ')',
194
+                    $result->getMessage().' (url: '.(string) $result->getResponse()->getUri().')',
195 195
                     $result->getStatus(),
196 196
                     $result->getValue(),
197 197
                     $tool,
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
     private function getIdentifier(CheckResult $result)
206 206
     {
207
-        return $this->tool . '_' . $result->getRuleName();
207
+        return $this->tool.'_'.$result->getRuleName();
208 208
     }
209 209
 
210 210
     private function getPrefix($string)
Please login to merge, or discard this patch.
src/Rules/Html/InvalidUrlsRule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
 
28 28
         foreach ($urls as $url) {
29 29
 
30
-            $idnUrl = $url->getScheme() . '://' . idn_to_ascii($url->getHost()) .  $url->getPath();
30
+            $idnUrl = $url->getScheme().'://'.idn_to_ascii($url->getHost()).$url->getPath();
31 31
 
32 32
             if (!filter_var($idnUrl, FILTER_VALIDATE_URL)) {
33
-                $invalidUrls[] = (string)$url;
33
+                $invalidUrls[] = (string) $url;
34 34
             }
35 35
         }
36 36
 
37
-        $this->assert(count($invalidUrls) === 0, 'Invalid urls found (' . implode(', ', $invalidUrls) . ').');
37
+        $this->assert(count($invalidUrls) === 0, 'Invalid urls found ('.implode(', ', $invalidUrls).').');
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
src/Rules/CheckResult.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * Result constructor.
26 26
      *
27 27
      * @param $status
28
-     * @param $value
28
+     * @param integer $value
29 29
      * @param $message
30 30
      */
31 31
     public function __construct($status, $message = '', $value = null)
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     }
45 45
 
46 46
     /**
47
-     * @param array $attributes
47
+     * @param array $attribute
48 48
      */
49 49
     public function addAttribute(Attribute $attribute)
50 50
     {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     /**
71
-     * @return mixed
71
+     * @return string
72 72
      */
73 73
     public function getMessage()
74 74
     {
Please login to merge, or discard this patch.
src/Rules/Seo/GoogleMobileFriendlyRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     private function getEndpoint(Uri $uri)
16 16
     {
17 17
         // return str_replace('#url#', urlencode('https://webhook.koalamon.com'), self::ENDPOINT);
18
-        return str_replace('#url#', urlencode((string)$uri), self::ENDPOINT);
18
+        return str_replace('#url#', urlencode((string) $uri), self::ENDPOINT);
19 19
     }
20 20
 
21 21
     public function validate(Response $response)
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             )));
35 35
 
36 36
         if (property_exists($result, 'error')) {
37
-            $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "' . $result->error->message . '"');
37
+            $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "'.$result->error->message.'"');
38 38
             $checkResult->addAttribute(new Attribute('Google response', json_encode($result), true));
39 39
             return $checkResult;
40 40
         }
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
         $passResult = $result->ruleGroups->USABILITY;
43 43
 
44 44
         if (!$passResult->pass) {
45
-            return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score ' . $passResult->score . '/100.', (int)$passResult->score);
45
+            return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score '.$passResult->score.'/100.', (int) $passResult->score);
46 46
         }
47 47
 
48
-        return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score ' . $passResult->score . '/100.', (int)$passResult->score);
48
+        return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score '.$passResult->score.'/100.', (int) $passResult->score);
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
src/Cli/Command/SmokeCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function writeSmokeCredentials($url = null)
60 60
     {
61
-        $this->output->writeln("\n Smoke " . SMOKE_VERSION . " by Nils Langner\n");
61
+        $this->output->writeln("\n Smoke ".SMOKE_VERSION." by Nils Langner\n");
62 62
 
63 63
         if ($url) {
64
-            $this->output->writeln(' <info>Scanning ' . $url . "</info>\n");
64
+            $this->output->writeln(' <info>Scanning '.$url."</info>\n");
65 65
         }
66 66
     }
67 67
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                     $httpClient->disableCache();
128 128
                 }
129 129
 
130
-                $fileContent = (string)$httpClient->get($configFile)->getBody();
130
+                $fileContent = (string) $httpClient->get($configFile)->getBody();
131 131
 
132 132
                 if ($httpClient instanceof CacheAware) {
133 133
                     $httpClient->enableCache();
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 if (file_exists($configFile)) {
137 137
                     $fileContent = file_get_contents($configFile);
138 138
                 } else {
139
-                    throw new \RuntimeException("Config file was not found ('" . $configFile . "').");
139
+                    throw new \RuntimeException("Config file was not found ('".$configFile."').");
140 140
                 }
141 141
             }
142 142
             $configArray = EnvAwareYaml::parse($fileContent);
Please login to merge, or discard this patch.