@@ -23,10 +23,10 @@ |
||
23 | 23 | { |
24 | 24 | if (array_key_exists('issuer', $certInfo) and array_key_exists('CN', $certInfo['issuer'])) { |
25 | 25 | if ($certInfo['issuer']['CN'] !== $this->authorityName) { |
26 | - throw new ValidationFailedException('Expected authority was "' . $this->authorityName . '", "' . $certInfo['issuer']['CN'] . '" found.'); |
|
26 | + throw new ValidationFailedException('Expected authority was "'.$this->authorityName.'", "'.$certInfo['issuer']['CN'].'" found.'); |
|
27 | 27 | } |
28 | 28 | } else { |
29 | - throw new ValidationFailedException('Expected authority was "' . $this->authorityName . '". No authority found.'); |
|
29 | + throw new ValidationFailedException('Expected authority was "'.$this->authorityName.'". No authority found.'); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -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 | } |
@@ -96,7 +96,7 @@ |
||
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); |
@@ -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 | */ |
@@ -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()); |
@@ -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, |