@@ -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 | */ |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | foreach ($this->results as $results) { |
121 | 121 | foreach ($results as $result) { |
122 | 122 | /* @var CheckResult $result */ |
123 | - $tool = 'Smoke' . $result->getRuleName(); |
|
123 | + $tool = 'Smoke'.$result->getRuleName(); |
|
124 | 124 | $checks[$tool][] = $result; |
125 | 125 | } |
126 | 126 | } |
@@ -132,19 +132,19 @@ discard block |
||
132 | 132 | continue; |
133 | 133 | } |
134 | 134 | |
135 | - $message = 'The smoke test for #system_name# failed (Rule: ' . $toolName . ').<ul>'; |
|
135 | + $message = 'The smoke test for #system_name# failed (Rule: '.$toolName.').<ul>'; |
|
136 | 136 | $status = Event::STATUS_SUCCESS; |
137 | 137 | $failureCount = 0; |
138 | - $identifier = $toolName . '_' . $this->system; |
|
138 | + $identifier = $toolName.'_'.$this->system; |
|
139 | 139 | |
140 | 140 | foreach ($results as $result) { |
141 | 141 | /** @var CheckResult $result */ |
142 | 142 | if ($result->getStatus() === CheckResult::STATUS_FAILURE) { |
143 | 143 | $comingFrom = ''; |
144 | 144 | if ($this->addComingFrom && $this->retriever->getComingFrom($result->getResponse()->getUri())) { |
145 | - $comingFrom = ', coming from: ' . $this->retriever->getComingFrom($result->getResponse()->getUri()); |
|
145 | + $comingFrom = ', coming from: '.$this->retriever->getComingFrom($result->getResponse()->getUri()); |
|
146 | 146 | } |
147 | - $message .= '<li>' . $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . $comingFrom . ')</li>'; |
|
147 | + $message .= '<li>'.$result->getMessage().' (url: '.(string) $result->getResponse()->getUri().$comingFrom.')</li>'; |
|
148 | 148 | ++$failureCount; |
149 | 149 | } |
150 | 150 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | $status = Event::STATUS_FAILURE; |
153 | 153 | $message .= '</ul>'; |
154 | 154 | $firstResult = array_pop($results); |
155 | - $attributes[] = new Attribute('html-content', (string)$firstResult->getResponse()->getBody(), true); |
|
155 | + $attributes[] = new Attribute('html-content', (string) $firstResult->getResponse()->getBody(), true); |
|
156 | 156 | } else { |
157 | - $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:' . $toolName . '].'; |
|
157 | + $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:'.$toolName.'].'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $this->send($identifier, $this->system, $message, $status, $failureCount, $this->tool, $this->system, $attributes); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | foreach ($results as $result) { |
168 | 168 | /* @var CheckResult $result */ |
169 | 169 | |
170 | - $identifier = '_' . $this->getIdentifier($result); |
|
170 | + $identifier = '_'.$this->getIdentifier($result); |
|
171 | 171 | $tool = $this->getPrefix($result->getRuleName()); |
172 | 172 | |
173 | 173 | $component = $this->getComponent($result->getRuleName()); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $attributes = array(); |
177 | 177 | if ($result->getStatus() == CheckResult::STATUS_FAILURE) { |
178 | - $body = (string)$result->getResponse()->getBody(); |
|
178 | + $body = (string) $result->getResponse()->getBody(); |
|
179 | 179 | if ($body == "") { |
180 | 180 | $attributes[] = new Attribute('html content', '<empty>'); |
181 | 181 | } else { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $this->send( |
200 | 200 | $identifier, |
201 | 201 | $currentSystem, |
202 | - $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . ')', |
|
202 | + $result->getMessage().' (url: '.(string) $result->getResponse()->getUri().')', |
|
203 | 203 | $result->getStatus(), |
204 | 204 | $result->getValue(), |
205 | 205 | $tool, |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | private function getIdentifier(CheckResult $result) |
214 | 214 | { |
215 | - return $this->tool . '_' . $result->getRuleName(); |
|
215 | + return $this->tool.'_'.$result->getRuleName(); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | 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 | } |
@@ -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, |