@@ -30,13 +30,13 @@ |
||
30 | 30 | |
31 | 31 | protected function renderFailure(CheckResult $result) |
32 | 32 | { |
33 | - $this->output->writeln(' <error> ' . (string) $result->getResponse()->getUri() . ' </error> coming from ' . (string) $this->retriever->getComingFrom($result->getResponse()->getUri())); |
|
34 | - $this->output->writeln(' - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']'); |
|
33 | + $this->output->writeln(' <error> '.(string) $result->getResponse()->getUri().' </error> coming from '.(string) $this->retriever->getComingFrom($result->getResponse()->getUri())); |
|
34 | + $this->output->writeln(' - '.$result->getMessage().' [rule: '.$result->getRuleName().']'); |
|
35 | 35 | $this->output->writeln(''); |
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function renderSuccess(CheckResult $result) |
39 | 39 | { |
40 | - $this->output->writeln(' <info> ' . (string) $result->getResponse()->getUri() . ' </info> all tests passed'); |
|
40 | + $this->output->writeln(' <info> '.(string) $result->getResponse()->getUri().' </info> all tests passed'); |
|
41 | 41 | } |
42 | 42 | } |
@@ -43,6 +43,11 @@ |
||
43 | 43 | return json_decode($systems->getBody(), true); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $url |
|
48 | + * |
|
49 | + * @return string |
|
50 | + */ |
|
46 | 51 | private function prepareUrl($url) |
47 | 52 | { |
48 | 53 | $preparedUrl = str_replace('#project#', $this->project, $url); |
@@ -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 | */ |
@@ -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) |
@@ -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 | } |
@@ -26,19 +26,19 @@ |
||
26 | 26 | $validTo = date('d.m.Y H:i:s', $certInfo['validTo_time_t']); |
27 | 27 | |
28 | 28 | if ($certInfo['validFrom_time_t'] > time() || $certInfo['validTo_time_t'] < time()) { |
29 | - $errorMessage = 'Certificate is expired. [' . $validFrom . ' - ' . $validTo . ']'; |
|
29 | + $errorMessage = 'Certificate is expired. ['.$validFrom.' - '.$validTo.']'; |
|
30 | 30 | |
31 | 31 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage); |
32 | 32 | $result->addAttribute(new Attribute('certificate information', json_encode($certInfo), true)); |
33 | 33 | return $result; |
34 | - } elseif ($certInfo['validTo_time_t'] < strtotime('+' . $this->expireWarningTime . 'days')) { |
|
35 | - $errorMessage = 'Certificate warning, expires in less than ' . $this->expireWarningTime . ' days. Certificate expires at: ' . $validTo; |
|
34 | + } elseif ($certInfo['validTo_time_t'] < strtotime('+'.$this->expireWarningTime.'days')) { |
|
35 | + $errorMessage = 'Certificate warning, expires in less than '.$this->expireWarningTime.' days. Certificate expires at: '.$validTo; |
|
36 | 36 | |
37 | 37 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage); |
38 | 38 | $result->addAttribute(new Attribute('certificate information', json_encode($certInfo), true)); |
39 | 39 | return $result; |
40 | 40 | } |
41 | 41 | |
42 | - return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next ' . $this->expireWarningTime . ' days. Expire date: ' . $validTo . '.'); |
|
42 | + return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next '.$this->expireWarningTime.' days. Expire date: '.$validTo.'.'); |
|
43 | 43 | } |
44 | 44 | } |