@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | foreach ($matches[1] as $varName) { |
14 | 14 | if (!getenv($varName)) { |
15 | - throw new \RuntimeException('The mandatory env variable (' . $varName . ') from the config file was not set.'); |
|
15 | + throw new \RuntimeException('The mandatory env variable ('.$varName.') from the config file was not set.'); |
|
16 | 16 | } |
17 | 17 | |
18 | - $fileContent = str_replace('${' . $varName . '}', getenv($varName), $fileContent); |
|
18 | + $fileContent = str_replace('${'.$varName.'}', getenv($varName), $fileContent); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | return Yaml::parse($fileContent); |
@@ -22,14 +22,14 @@ |
||
22 | 22 | if (count($results) > 0) { |
23 | 23 | ++$this->urlCount; |
24 | 24 | $firstResult = array_pop($results); |
25 | - $this->output->writeln(' ' . (string) $firstResult->getResponse()->getUri()); |
|
25 | + $this->output->writeln(' '.(string) $firstResult->getResponse()->getUri()); |
|
26 | 26 | $this->output->writeln(''); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function finish() |
31 | 31 | { |
32 | - $this->output->writeln(' <comment>Warm up finished. ' . $this->urlCount . ' urls visited.</comment>'); |
|
32 | + $this->output->writeln(' <comment>Warm up finished. '.$this->urlCount.' urls visited.</comment>'); |
|
33 | 33 | $this->output->writeln(''); |
34 | 34 | } |
35 | 35 | } |
@@ -198,12 +198,12 @@ |
||
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 | */ |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | foreach ($this->results as $results) { |
129 | 129 | foreach ($results as $result) { |
130 | 130 | /* @var CheckResult $result */ |
131 | - $tool = 'Smoke' . $result->getRuleName(); |
|
131 | + $tool = 'Smoke'.$result->getRuleName(); |
|
132 | 132 | $checks[$tool][] = $result; |
133 | 133 | } |
134 | 134 | } |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | continue; |
141 | 141 | } |
142 | 142 | |
143 | - $message = 'The smoke test for #system_name# failed (Rule: ' . $toolName . ').<ul>'; |
|
143 | + $message = 'The smoke test for #system_name# failed (Rule: '.$toolName.').<ul>'; |
|
144 | 144 | $status = Event::STATUS_SUCCESS; |
145 | 145 | $failureCount = 0; |
146 | - $identifier = $toolName . '_' . $this->system; |
|
146 | + $identifier = $toolName.'_'.$this->system; |
|
147 | 147 | |
148 | 148 | foreach ($results as $result) { |
149 | 149 | /** @var CheckResult $result */ |
150 | 150 | if ($result->getStatus() === CheckResult::STATUS_FAILURE) { |
151 | 151 | $comingFrom = ''; |
152 | 152 | if ($this->addComingFrom && $this->retriever->getComingFrom($result->getResponse()->getUri())) { |
153 | - $comingFrom = ', coming from: ' . $this->retriever->getComingFrom($result->getResponse()->getUri()); |
|
153 | + $comingFrom = ', coming from: '.$this->retriever->getComingFrom($result->getResponse()->getUri()); |
|
154 | 154 | } |
155 | - $message .= '<li>' . $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . $comingFrom . ')</li>'; |
|
155 | + $message .= '<li>'.$result->getMessage().' (url: '.(string) $result->getResponse()->getUri().$comingFrom.')</li>'; |
|
156 | 156 | ++$failureCount; |
157 | 157 | } |
158 | 158 | } |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | $response = $firstResult->getResponse(); |
164 | 164 | /** @var ResponseInterface $response */ |
165 | 165 | |
166 | - $attributes[] = new Attribute('html-content', (string)$response->getBody(), true); |
|
166 | + $attributes[] = new Attribute('html-content', (string) $response->getBody(), true); |
|
167 | 167 | if ($response instanceof TimeoutAwareResponse) { |
168 | 168 | $attributes[] = new Attribute('timeout', $response->isTimeout()); |
169 | 169 | } |
170 | 170 | } else { |
171 | - $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:' . $toolName . '].'; |
|
171 | + $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:'.$toolName.'].'; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $this->send($identifier, $this->system, $message, $status, $failureCount, $this->tool, $this->system, $attributes); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | foreach ($results as $result) { |
182 | 182 | /* @var CheckResult $result */ |
183 | 183 | |
184 | - $identifier = '_' . $this->getIdentifier($result); |
|
184 | + $identifier = '_'.$this->getIdentifier($result); |
|
185 | 185 | $tool = $this->getPrefix($result->getRuleName()); |
186 | 186 | |
187 | 187 | $component = $this->getComponent($result->getRuleName()); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $attributes = array(); |
191 | 191 | if ($result->getStatus() == CheckResult::STATUS_FAILURE) { |
192 | - $body = (string)$result->getResponse()->getBody(); |
|
192 | + $body = (string) $result->getResponse()->getBody(); |
|
193 | 193 | if ($body == "") { |
194 | 194 | $attributes[] = new Attribute('html content', '<empty>'); |
195 | 195 | } else { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $this->send( |
220 | 220 | $identifier, |
221 | 221 | $currentSystem, |
222 | - $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . ')', |
|
222 | + $result->getMessage().' (url: '.(string) $result->getResponse()->getUri().')', |
|
223 | 223 | $result->getStatus(), |
224 | 224 | $result->getValue(), |
225 | 225 | $tool, |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | private function getIdentifier(CheckResult $result) |
236 | 236 | { |
237 | 237 | if ($this->useUrlAsIdentifier) { |
238 | - $suffix = '_' . md5((string)$result->getResponse()->getUri()); |
|
238 | + $suffix = '_'.md5((string) $result->getResponse()->getUri()); |
|
239 | 239 | } else { |
240 | 240 | $suffix = ''; |
241 | 241 | } |
242 | 242 | |
243 | - return $this->tool . '_' . $result->getRuleName() . $suffix; |
|
243 | + return $this->tool.'_'.$result->getRuleName().$suffix; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | private function getPrefix($string) |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | $this->reporter->sendEvent($event); |
273 | 273 | } catch (KoalamonException $e) { |
274 | 274 | $this->output->writeln("\n <error> Error sending result to leankoala. </error>"); |
275 | - $this->output->writeln(' Url: ' . $e->getUrl()); |
|
276 | - $this->output->writeln(' Payload: ' . $e->getPayload()); |
|
275 | + $this->output->writeln(' Url: '.$e->getUrl()); |
|
276 | + $this->output->writeln(' Payload: '.$e->getPayload()); |
|
277 | 277 | $this->output->writeln(""); |
278 | 278 | } catch (\Exception $e) { |
279 | 279 | $this->output->writeln($e->getMessage()); |
@@ -24,13 +24,13 @@ |
||
24 | 24 | |
25 | 25 | foreach ($this->checkedHeaders as $headerConfig) { |
26 | 26 | if (!$response->hasHeader($headerConfig['key'])) { |
27 | - throw new ValidationFailedException('Header not found (' . $headerConfig['key'] . ')'); |
|
27 | + throw new ValidationFailedException('Header not found ('.$headerConfig['key'].')'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $currentValue = $response->getHeader($headerConfig['key'])[0]; |
31 | 31 | |
32 | - if (!preg_match('%' . $headerConfig['value'] . '%', $currentValue, $matches)) { |
|
33 | - throw new ValidationFailedException('Header "' . $headerConfig['key'] . '" does not match "' . $headerConfig['value'] . '". Current value is "' . $currentValue . '"'); |
|
32 | + if (!preg_match('%'.$headerConfig['value'].'%', $currentValue, $matches)) { |
|
33 | + throw new ValidationFailedException('Header "'.$headerConfig['key'].'" does not match "'.$headerConfig['value'].'". Current value is "'.$currentValue.'"'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Psr\Http\Message\ResponseInterface; |
6 | 6 | use whm\Html\Document; |
7 | -use whm\Smoke\Http\Response; |
|
8 | 7 | |
9 | 8 | /** |
10 | 9 | * This rules counts the css files that are included in a document. If the number is higher |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Psr\Http\Message\ResponseInterface; |
6 | 6 | use whm\Html\Document; |
7 | -use whm\Smoke\Http\Response; |
|
8 | 7 | |
9 | 8 | /** |
10 | 9 | * This rules counts the js files that are included in a document. If the number is higher |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace whm\Smoke\Rules\Http; |
4 | 4 | |
5 | 5 | use Psr\Http\Message\ResponseInterface; |
6 | -use whm\Smoke\Http\Response; |
|
7 | 6 | use whm\Smoke\Rules\Rule; |
8 | 7 | |
9 | 8 | abstract class HttpsRule implements Rule |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $sslOptions = stream_context_create(array('ssl' => array('capture_peer_cert' => true))); |
25 | 25 | |
26 | 26 | $request = @stream_socket_client( |
27 | - 'ssl://' . $host . ':443', |
|
27 | + 'ssl://'.$host.':443', |
|
28 | 28 | $errno, |
29 | 29 | $errstr, |
30 | 30 | 30, |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace whm\Smoke\Rules\Image; |
4 | 4 | |
5 | 5 | use Psr\Http\Message\ResponseInterface; |
6 | -use whm\Smoke\Http\Response; |
|
7 | 6 | use whm\Smoke\Rules\StandardRule; |
8 | 7 | |
9 | 8 | /** |
@@ -30,8 +30,8 @@ |
||
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
33 | - $imageHash = md5((string)$response->getBody()); |
|
33 | + $imageHash = md5((string) $response->getBody()); |
|
34 | 34 | |
35 | - $this->assert(!array_key_exists($imageHash, $this->favicons), 'Seems like you use the standard favicon of your framework (' . $this->favicons[$imageHash] . ').'); |
|
35 | + $this->assert(!array_key_exists($imageHash, $this->favicons), 'Seems like you use the standard favicon of your framework ('.$this->favicons[$imageHash].').'); |
|
36 | 36 | } |
37 | 37 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use JsonSchema\Validator; |
6 | 6 | use Psr\Http\Message\ResponseInterface; |
7 | -use whm\Smoke\Http\Response; |
|
8 | 7 | use whm\Smoke\Rules\StandardRule; |
9 | 8 | use whm\Smoke\Rules\ValidationFailedException; |
10 | 9 |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | |
34 | 34 | protected function doValidation(ResponseInterface $response) |
35 | 35 | { |
36 | - $data = json_decode((string)$response->getBody()); |
|
36 | + $data = json_decode((string) $response->getBody()); |
|
37 | 37 | if ($data === null) { |
38 | - throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "')."); |
|
38 | + throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."')."); |
|
39 | 39 | } else { |
40 | 40 | $errorStatus = false; |
41 | 41 | $messageParts = array(); |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | $errorStatus = true; |
52 | 52 | $errorMessage = ''; |
53 | 53 | foreach ($validator->getErrors() as $error) { |
54 | - $errorMessage = $errorMessage . sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
54 | + $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
55 | 55 | } |
56 | - $messageParts[] = $jsonSchemaFile['jsonfilename'] . ' - ' . $jsonSchemaFile['jsonfileurl'] . '(last error: ' . $errorMessage . ').'; |
|
56 | + $messageParts[] = $jsonSchemaFile['jsonfilename'].' - '.$jsonSchemaFile['jsonfileurl'].'(last error: '.$errorMessage.').'; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($errorStatus === true) { |
61 | - $message = 'JSON file (' . (string) $response->getUri() . ') does not validate against the following JSON Schema files: ' . implode(', ', $messageParts); |
|
61 | + $message = 'JSON file ('.(string) $response->getUri().') does not validate against the following JSON Schema files: '.implode(', ', $messageParts); |
|
62 | 62 | throw new ValidationFailedException($message); |
63 | 63 | } |
64 | 64 | } |