@@ -35,7 +35,7 @@ |
||
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 | } |
@@ -126,7 +126,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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()); |
@@ -31,23 +31,23 @@ |
||
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 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | if ($response instanceof ContentTypeAwareResponse) { |
18 | 18 | |
19 | 19 | // @todo this could be part of the StandardRule class |
20 | - $body = (string)$response->getBody(); |
|
20 | + $body = (string) $response->getBody(); |
|
21 | 21 | $body = preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F,\xFF,\x8B]/', '', $body); |
22 | 22 | |
23 | 23 | if (($response->getStatusCode() < 300 || $response->getStatusCode() >= 400) |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | && strlen($body) > 0 |
26 | 26 | ) { |
27 | 27 | if (stripos($body, '</html>') === false) { |
28 | - throw new ValidationFailedException('Closing html tag is missing (document length: ' . strlen($body) . ').'); |
|
28 | + throw new ValidationFailedException('Closing html tag is missing (document length: '.strlen($body).').'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
@@ -18,19 +18,19 @@ |
||
18 | 18 | */ |
19 | 19 | protected function doValidation(ResponseInterface $response) |
20 | 20 | { |
21 | - $document = new Document((string)$response->getBody(), false); |
|
21 | + $document = new Document((string) $response->getBody(), false); |
|
22 | 22 | $urls = $document->getDependencies($response->getUri()); |
23 | 23 | $invalidUrls = array(); |
24 | 24 | |
25 | 25 | foreach ($urls as $url) { |
26 | 26 | |
27 | - $idnUrl = $url->getScheme() . '://' . idn_to_ascii($url->getHost()) . $url->getPath(); |
|
27 | + $idnUrl = $url->getScheme().'://'.idn_to_ascii($url->getHost()).$url->getPath(); |
|
28 | 28 | |
29 | 29 | if (!filter_var($idnUrl, FILTER_VALIDATE_URL)) { |
30 | - $invalidUrls[] = (string)$url; |
|
30 | + $invalidUrls[] = (string) $url; |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - $this->assert(count($invalidUrls) === 0, 'Invalid urls found (' . implode(', ', $invalidUrls) . ').'); |
|
34 | + $this->assert(count($invalidUrls) === 0, 'Invalid urls found ('.implode(', ', $invalidUrls).').'); |
|
35 | 35 | } |
36 | 36 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | return; |
45 | 45 | } |
46 | 46 | |
47 | - $htmlDocument = new Document((string)$response->getBody()); |
|
47 | + $htmlDocument = new Document((string) $response->getBody()); |
|
48 | 48 | |
49 | 49 | $resources = $htmlDocument->getDependencies($uri, false); |
50 | 50 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($resource->getScheme() && 'https' !== $resource->getScheme()) { |
55 | 55 | $excluded = false; |
56 | 56 | foreach ($this->excludedFiles as $excludedFile) { |
57 | - if (preg_match('~' . $excludedFile . '~', (string)$resource)) { |
|
57 | + if (preg_match('~'.$excludedFile.'~', (string) $resource)) { |
|
58 | 58 | $excluded = true; |
59 | 59 | break; |
60 | 60 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if (count($unsecures) > 0) { |
69 | 69 | $message = 'At least one dependency was found on a secure url, that was transfered insecure.<ul>'; |
70 | 70 | foreach ($unsecures as $unsecure) { |
71 | - $message .= '<li>' . (string)$unsecure . '</li>'; |
|
71 | + $message .= '<li>'.(string) $unsecure.'</li>'; |
|
72 | 72 | } |
73 | 73 | $message .= '</ul>'; |
74 | 74 | return new CheckResult(CheckResult::STATUS_FAILURE, $message, count($unsecures)); |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | |
22 | 22 | private function getSchema() |
23 | 23 | { |
24 | - return __DIR__ . '/' . self::SCHEMA; |
|
24 | + return __DIR__.'/'.self::SCHEMA; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function doValidation(ResponseInterface $response) |
28 | 28 | { |
29 | - $body = (string)$response->getBody(); |
|
29 | + $body = (string) $response->getBody(); |
|
30 | 30 | |
31 | 31 | if (preg_match('/<rss/', $body)) { |
32 | 32 | libxml_clear_errors(); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $lastError = libxml_get_last_error(); |
36 | 36 | if ($lastError) { |
37 | 37 | throw new ValidationFailedException( |
38 | - 'The given xml file is not well formed (last error: ' . |
|
39 | - str_replace("\n", '', $lastError->message) . ').'); |
|
38 | + 'The given xml file is not well formed (last error: '. |
|
39 | + str_replace("\n", '', $lastError->message).').'); |
|
40 | 40 | } |
41 | 41 | $valid = @$dom->schemaValidate($this->getSchema()); |
42 | 42 | if (!$valid) { |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $lastErrorMessage = str_replace("\n", '', $lastError->message); |
45 | 45 | |
46 | 46 | if ($response instanceof UriAwareResponse) { |
47 | - $toolUrl = sprintf(self::PUBLIC_SERVICE, urlencode((string)$response->getUri())); |
|
47 | + $toolUrl = sprintf(self::PUBLIC_SERVICE, urlencode((string) $response->getUri())); |
|
48 | 48 | } else { |
49 | 49 | $toolUrl = ''; |
50 | 50 | } |
51 | - return new CheckResult(CheckResult::STATUS_FAILURE, 'The given xml file is not a valid rss file (last error: ' . $lastErrorMessage . ').', null, $toolUrl); |
|
51 | + return new CheckResult(CheckResult::STATUS_FAILURE, 'The given xml file is not a valid rss file (last error: '.$lastErrorMessage.').', null, $toolUrl); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | return new CheckResult(CheckResult::STATUS_SUCCESS, 'The given rss file is valid.'); |