@@ -67,6 +67,9 @@ |
||
67 | 67 | return md5(json_encode((string)$uri) . json_encode($headers)); |
68 | 68 | } |
69 | 69 | |
70 | + /** |
|
71 | + * @param string $key |
|
72 | + */ |
|
70 | 73 | private function cacheResponse($key, Response $response) |
71 | 74 | { |
72 | 75 | $serializedResponse = $this->serializeResponse($response); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | private function serializeResponse(Response $response) |
43 | 43 | { |
44 | - $array = ['object' => serialize($response), 'body' => (string)$response->getBody()]; |
|
44 | + $array = ['object' => serialize($response), 'body' => (string) $response->getBody()]; |
|
45 | 45 | return serialize($array); |
46 | 46 | } |
47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function getHash($uri, $headers) |
66 | 66 | { |
67 | - return md5(json_encode((string)$uri) . json_encode($headers)); |
|
67 | + return md5(json_encode((string) $uri).json_encode($headers)); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | private function cacheResponse($key, Response $response) |
@@ -118,7 +118,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) |
@@ -58,10 +58,10 @@ discard block |
||
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 |
||
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 |
||
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); |