Completed
Pull Request — master (#90)
by
unknown
03:21 queued 03:21
created
src/Extensions/SmokeResponseRetriever/Retriever/Koalamon/Retriever.php 1 patch
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -42,6 +42,11 @@
 block discarded – undo
42 42
         return json_decode($systems->getBody());
43 43
     }
44 44
 
45
+    /**
46
+     * @param string $url
47
+     *
48
+     * @return string
49
+     */
45 50
     private function prepareUrl($url)
46 51
     {
47 52
         $preparedUrl = str_replace("#project#", $this->project, $url);
Please login to merge, or discard this patch.
src/Http/Response.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -13,6 +13,9 @@
 block discarded – undo
13 13
         return $this->getStatusCode();
14 14
     }
15 15
 
16
+    /**
17
+     * @return string
18
+     */
16 19
     public function getContentType()
17 20
     {
18 21
         $exploded = explode(';', $this->hasHeader('Content-Type') ? $this->getHeader('Content-Type')[0] : null);
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/KoalamonReporter.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -159,6 +159,10 @@
 block discarded – undo
159 159
         }
160 160
     }
161 161
 
162
+    /**
163
+     * @param string $identifier
164
+     * @param string $message
165
+     */
162 166
     public function send($identifier, $system, $message, $status, $url = '', $value = 0)
163 167
     {
164 168
         $event = new Event($identifier, $system, $status, $this->tool, $message, $value);
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function finish()
94 94
     {
95
-        $this->output->writeln('Sending results to ' . $this->server . " ... \n");
95
+        $this->output->writeln('Sending results to '.$this->server." ... \n");
96 96
 
97 97
         if ($this->groupBy === 'prefix') {
98 98
             $this->sendGroupedByPrefix();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
         foreach ($this->getRuleKeys() as $rule) {
125 125
             foreach ($systems as $system) {
126
-                $identifier = $this->tool . '_' . $this->getPrefix($rule) . '_' . $system;
126
+                $identifier = $this->tool.'_'.$this->getPrefix($rule).'_'.$system;
127 127
                 $failureMessages[$identifier]['message'] = '';
128 128
                 $failureMessages[$identifier]['system'] = $system;
129 129
                 $failureMessages[$identifier]['tool'] = $this->getPrefix($rule);
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
                         $system = $this->retriever->getSystem(($result->getUrl()));
141 141
                     }
142 142
 
143
-                    $identifer = $this->tool . '_' . $this->getPrefix($ruleLKey) . '_' . $system;
143
+                    $identifer = $this->tool.'_'.$this->getPrefix($ruleLKey).'_'.$system;
144 144
 
145 145
                     if ($failureMessages[$identifer]['message'] === '') {
146
-                        $failureMessages[$identifer]['message'] = 'The ' . $this->getPrefix($ruleLKey) . ' test for #system_name# failed.<ul>';
146
+                        $failureMessages[$identifer]['message'] = 'The '.$this->getPrefix($ruleLKey).' test for #system_name# failed.<ul>';
147 147
                     }
148 148
                     ++$counter[$identifer];
149
-                    $failureMessages[$identifer]['message'] .= '<li>' . $message . '<br>url: ' . $result->getUrl() . ', coming from: ' . $this->retriever->getComingFrom($result->getUrl()) . '</li>';
149
+                    $failureMessages[$identifer]['message'] .= '<li>'.$message.'<br>url: '.$result->getUrl().', coming from: '.$this->retriever->getComingFrom($result->getUrl()).'</li>';
150 150
                 }
151 151
             }
152 152
         }
153 153
 
154 154
         foreach ($failureMessages as $key => $failureMessage) {
155 155
             if ($failureMessage['message'] !== '') {
156
-                $this->send($this->identifier . '_' . $key, $failureMessage['system'], $failureMessage['message'] . '</ul>', self::STATUS_FAILURE, '', $counter[$key], $failureMessage['tool']);
156
+                $this->send($this->identifier.'_'.$key, $failureMessage['system'], $failureMessage['message'].'</ul>', self::STATUS_FAILURE, '', $counter[$key], $failureMessage['tool']);
157 157
             } else {
158
-                $this->send($this->identifier . '_' . $key, $failureMessage['system'], '', self::STATUS_SUCCESS, '', 0, $failureMessage['tool']);
158
+                $this->send($this->identifier.'_'.$key, $failureMessage['system'], '', self::STATUS_SUCCESS, '', 0, $failureMessage['tool']);
159 159
             }
160 160
         }
161 161
     }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $failedTests = array();
168 168
             if ($result->isFailure()) {
169 169
                 foreach ($result->getMessages() as $ruleLKey => $message) {
170
-                    $identifier = 'smoke_' . $ruleLKey . '_' . $result->getUrl();
170
+                    $identifier = 'smoke_'.$ruleLKey.'_'.$result->getUrl();
171 171
 
172 172
                     if ($this->system === '') {
173 173
                         $system = str_replace('http://', '', $result->getUrl());
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             }
181 181
             foreach ($rules as $rule) {
182 182
                 if (!in_array($rule, $failedTests, true)) {
183
-                    $identifier = 'smoke_' . $rule . '_' . $result->getUrl();
183
+                    $identifier = 'smoke_'.$rule.'_'.$result->getUrl();
184 184
 
185 185
                     if ($this->systemUseRetriever) {
186 186
                         $system = $this->retriever->getSystem($result->getUrl());
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
                     } else {
190 190
                         $system = $this->system;
191 191
                     }
192
-                    $this->send($identifier, $system, 'smoke_' . $rule . '_' . $result->getUrl(), self::STATUS_SUCCESS, (string) $result->getUrl());
192
+                    $this->send($identifier, $system, 'smoke_'.$rule.'_'.$result->getUrl(), self::STATUS_SUCCESS, (string) $result->getUrl());
193 193
                 }
194 194
             }
195 195
         }
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
                         $system = $this->retriever->getSystem(new Uri($result->getUrl()));
214 214
                     }
215 215
                     if ($failureMessages[$ruleLKey] === '') {
216
-                        $failureMessages[$ruleLKey]['message'] = '    The smoke test for #system_name# failed (Rule: ' . $ruleLKey . ').<ul>';
216
+                        $failureMessages[$ruleLKey]['message'] = '    The smoke test for #system_name# failed (Rule: '.$ruleLKey.').<ul>';
217 217
                     }
218 218
                     ++$counter[$ruleLKey];
219 219
 
220 220
                     $comingFrom = '';
221 221
                     if ($this->retriever->getComingFrom($result->getUrl())) {
222
-                        $comingFrom = ', coming from: ' . $this->retriever->getComingFrom($result->getUrl());
222
+                        $comingFrom = ', coming from: '.$this->retriever->getComingFrom($result->getUrl());
223 223
                     }
224 224
 
225
-                    $failureMessages[$ruleLKey]['message'] .= '<li>' . $message . ' (url: ' . $result->getUrl() . $comingFrom . ')</li > ';
225
+                    $failureMessages[$ruleLKey]['message'] .= '<li>'.$message.' (url: '.$result->getUrl().$comingFrom.')</li > ';
226 226
                     $failureMessages[$ruleLKey]['system'] = $system;
227 227
                 }
228 228
             }
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 
231 231
         foreach ($failureMessages as $key => $failureMessage) {
232 232
             if ($failureMessage !== '') {
233
-                $this->send($this->identifier . '_' . $key, $this->system, $failureMessage['message'] . ' </ul > ', self::STATUS_FAILURE, '', $counter[$key]);
233
+                $this->send($this->identifier.'_'.$key, $this->system, $failureMessage['message'].' </ul > ', self::STATUS_FAILURE, '', $counter[$key]);
234 234
             } else {
235
-                $this->send($this->identifier . '_' . $key, $this->system, '', self::STATUS_SUCCESS, '', 0);
235
+                $this->send($this->identifier.'_'.$key, $this->system, '', self::STATUS_SUCCESS, '', 0);
236 236
             }
237 237
         }
238 238
     }
Please login to merge, or discard this patch.
src/Rules/Html/RegExExistsRule.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
     protected $contentTypes = array('text/html');
16 16
 
17 17
     /**
18
-     * @param int $string The string that the document must contain
19 18
      */
20 19
     public function init(array $regExs)
21 20
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
     protected function doValidation(Response $response)
26 26
     {
27 27
         foreach ($this->regExs as $regEx) {
28
-            $this->assert(preg_match('^' . $regEx . '^', (string) $response->getBody()) > 0,
29
-                'The given regular expression (' . $regEx . ') was not found in this document.');
28
+            $this->assert(preg_match('^'.$regEx.'^', (string) $response->getBody()) > 0,
29
+                'The given regular expression ('.$regEx.') was not found in this document.');
30 30
         }
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
src/Yaml/EnvAwareYaml.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
         preg_match_all('^\${(.*)}^', $fileContent, $matches);
12 12
         foreach ($matches[1] as $varName) {
13 13
             if (!getenv($varName)) {
14
-                throw new \RuntimeException('The mandatory env variable (' . $varName . ') from the config file was not set.');
14
+                throw new \RuntimeException('The mandatory env variable ('.$varName.') from the config file was not set.');
15 15
             }
16 16
 
17
-            $fileContent = str_replace('${' . $varName . '}', getenv($varName), $fileContent);
17
+            $fileContent = str_replace('${'.$varName.'}', getenv($varName), $fileContent);
18 18
         }
19 19
 
20 20
         return Yaml::parse($fileContent);
Please login to merge, or discard this patch.
src/Rules/Seo/RobotsDisallowAllRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public function validate(Response $response)
15 15
     {
16
-        $url = $response->getUri()->getScheme() . '://' . $response->getUri()->getHost();
16
+        $url = $response->getUri()->getScheme().'://'.$response->getUri()->getHost();
17 17
 
18 18
         if (substr_count($url, '/') === 2) {
19
-            $filename = $robotsUrl = $url . '/robots.txt';
19
+            $filename = $robotsUrl = $url.'/robots.txt';
20 20
         } elseif (substr_count($url, '/') === 3) {
21
-            $filename = $robotsUrl = $url . 'robots.txt';
21
+            $filename = $robotsUrl = $url.'robots.txt';
22 22
         } else {
23 23
             return;
24 24
         }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             $content = file_get_contents($filename);
30 30
             $normalizedContent = str_replace(' ', '', $content);
31 31
 
32
-            if (strpos($normalizedContent, 'Disallow:/' . PHP_EOL) !== false) {
32
+            if (strpos($normalizedContent, 'Disallow:/'.PHP_EOL) !== false) {
33 33
                 throw new ValidationFailedException('The robots.txt contains disallow all (Disallow: /)');
34 34
             }
35 35
         }
Please login to merge, or discard this patch.
src/Rules/Js/SyntaxRule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@
 block discarded – undo
30 30
             return;
31 31
         }
32 32
 
33
-        $filename = $this->tmpDir . DIRECTORY_SEPARATOR . md5($response->getBody()) . '.js';
33
+        $filename = $this->tmpDir.DIRECTORY_SEPARATOR.md5($response->getBody()).'.js';
34 34
         file_put_contents($filename, $response->getBody());
35
-        $conf = __DIR__ . DIRECTORY_SEPARATOR . 'jsHint.conf';
35
+        $conf = __DIR__.DIRECTORY_SEPARATOR.'jsHint.conf';
36 36
 
37
-        $command = $this->jsHintExecutable . ' --config ' . $conf . ' --verbose ' . $filename . ' | grep -E E[0-9]+.$';
37
+        $command = $this->jsHintExecutable.' --config '.$conf.' --verbose '.$filename.' | grep -E E[0-9]+.$';
38 38
         $validationResult = shell_exec($command);
39 39
 
40 40
         unlink($filename);
41 41
 
42 42
         if (!is_null($validationResult)) {
43
-            $errorMsg = str_replace($filename . ':', '', $validationResult);
44
-            throw new ValidationFailedException('JavaScript error found: ' . $errorMsg);
43
+            $errorMsg = str_replace($filename.':', '', $validationResult);
44
+            throw new ValidationFailedException('JavaScript error found: '.$errorMsg);
45 45
         }
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
src/Rules/Http/DurationRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     public function validate(Response $response)
26 26
     {
27 27
         if ($response->getDuration() > $this->maxDuration) {
28
-            throw new ValidationFailedException('the http request lasted ' . $response->getDuration() . ' milliseconds.');
28
+            throw new ValidationFailedException('the http request lasted '.$response->getDuration().' milliseconds.');
29 29
         }
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
src/Rules/Http/Header/SuccessStatusRule.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 validate(Response $response)
22 22
     {
23 23
         if ($response->getStatus() > $this->maxStatusCode) {
24
-            throw new ValidationFailedException('Status code ' . $response->getStatus() . ' found.');
24
+            throw new ValidationFailedException('Status code '.$response->getStatus().' found.');
25 25
         }
26 26
     }
27 27
 }
Please login to merge, or discard this patch.