@@ -50,7 +50,7 @@ |
||
50 | 50 | $configArray = $this->getConfigArray($configFile, true); |
51 | 51 | |
52 | 52 | if (is_string($configArray)) { |
53 | - throw new \RuntimeException('Unable to load config file. Please check ' . $configFile); |
|
53 | + throw new \RuntimeException('Unable to load config file. Please check '.$configFile); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $this->config = new Configuration(new Uri('http://www.example.com'), $dispatcher, $configArray); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->resultFile = $resultFile; |
29 | 29 | |
30 | 30 | if ($templateDir === null) { |
31 | - $this->templateDir = __DIR__ . '/templates'; |
|
31 | + $this->templateDir = __DIR__.'/templates'; |
|
32 | 32 | } else { |
33 | 33 | $this->templateDir = $templateDir; |
34 | 34 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | if (!file_put_contents($this->resultFile, $html)) { |
69 | - $this->output->writeln("<error>HTML Reporter extension: Could not write result file to " . $this->resultFile ."</error>"); |
|
69 | + $this->output->writeln("<error>HTML Reporter extension: Could not write result file to ".$this->resultFile."</error>"); |
|
70 | 70 | } else { |
71 | - $this->output->writeln("<info>HTML Reporter extension:</info> Result file written to " . $this->resultFile); |
|
71 | + $this->output->writeln("<info>HTML Reporter extension:</info> Result file written to ".$this->resultFile); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | const STATUS_SUCCESS = 'success'; |
53 | 53 | const STATUS_FAILURE = 'failure'; |
54 | 54 | |
55 | - public function init($apiKey, Configuration $_configuration, OutputInterface $_output, $server = 'https://webhook.koalamon.com', $system = '', $identifier = '', $tool = '', $url ='') |
|
55 | + public function init($apiKey, Configuration $_configuration, OutputInterface $_output, $server = 'https://webhook.koalamon.com', $system = '', $identifier = '', $tool = '', $url = '') |
|
56 | 56 | { |
57 | 57 | $httpClient = new \GuzzleHttp\Client(); |
58 | 58 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function processResults($results) |
83 | 83 | { |
84 | 84 | foreach ($results as $result) { |
85 | - if($result->getStatus() == CheckResult::STATUS_SUCCESS) { |
|
85 | + if ($result->getStatus() == CheckResult::STATUS_SUCCESS) { |
|
86 | 86 | $this->success++; |
87 | 87 | } else { |
88 | 88 | $this->failed++; |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | public function finish() |
94 | 94 | { |
95 | 95 | $message = 'Checks: '; |
96 | - $message .= $this->success . ' succeeded, '; |
|
97 | - $message .= $this->failed . ' failed. '; |
|
96 | + $message .= $this->success.' succeeded, '; |
|
97 | + $message .= $this->failed.' failed. '; |
|
98 | 98 | |
99 | 99 | if ($this->failed > 0) { |
100 | 100 | $status = Event::STATUS_FAILURE; |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | $this->reporter->sendEvent($event); |
130 | 130 | } catch (KoalamonException $e) { |
131 | 131 | $this->output->writeln("\n <error> Error sending result to leankoala. </error>"); |
132 | - $this->output->writeln(' Url: ' . $e->getUrl()); |
|
133 | - $this->output->writeln(' Payload: ' . $e->getPayload()); |
|
132 | + $this->output->writeln(' Url: '.$e->getUrl()); |
|
133 | + $this->output->writeln(' Payload: '.$e->getPayload()); |
|
134 | 134 | $this->output->writeln(""); |
135 | 135 | } catch (\Exception $e) { |
136 | 136 | $this->output->writeln($e->getMessage()); |
@@ -97,7 +97,7 @@ |
||
97 | 97 | } catch (ValidationFailedException $e) { |
98 | 98 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $e->getMessage()); |
99 | 99 | } catch (\Exception $e) { |
100 | - $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occured: ' . $e->getMessage()); |
|
100 | + $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occured: '.$e->getMessage()); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | $this->eventDispatcher->simpleNotify('Scanner.CheckResponse.Rule', array('checkResult' => $result, 'ruleName' => $name)); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | private function initConfigArray(array $configArray, array $defaultSettings = null) |
68 | 68 | { |
69 | 69 | if ($defaultSettings === null) { |
70 | - $defaultSettings = Yaml::parse(file_get_contents(__DIR__ . '/../settings/' . self::DEFAULT_SETTINGS)); |
|
70 | + $defaultSettings = Yaml::parse(file_get_contents(__DIR__.'/../settings/'.self::DEFAULT_SETTINGS)); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if (count($configArray) === 0) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if ($this->hasSection($section)) { |
170 | 170 | return $this->configArray[$section]; |
171 | 171 | } else { |
172 | - throw new \RuntimeException('The section (' . $section . ') you are trying to access does not exist.'); |
|
172 | + throw new \RuntimeException('The section ('.$section.') you are trying to access does not exist.'); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (array_key_exists($name, $this->extensions)) { |
179 | 179 | return $this->extensions[$name]; |
180 | 180 | } else { |
181 | - throw new \RuntimeException('The extension ("' . $name . '") you are trying to access does not exist. Registered extensions are: ' . implode(' ,', array_keys($this->extensions)) . '.'); |
|
181 | + throw new \RuntimeException('The extension ("'.$name.'") you are trying to access does not exist. Registered extensions are: '.implode(' ,', array_keys($this->extensions)).'.'); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | try { |
204 | 204 | $client = Init::initialize($this->configArray['client']); |
205 | 205 | } catch (\Exception $e) { |
206 | - throw new ConfigurationException('Error initializing client (' . $e->getMessage() . ')'); |
|
206 | + throw new ConfigurationException('Error initializing client ('.$e->getMessage().')'); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | return $client; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | if (strpos($response->getContentType(), 'image') === false |
26 | 26 | && strpos($response->getContentType(), 'pdf') === false |
27 | 27 | && strpos($response->getContentType(), 'postscript') === false |
28 | - && strlen((string)$response->getBody()) >= $this->minFileSize |
|
28 | + && strlen((string) $response->getBody()) >= $this->minFileSize |
|
29 | 29 | ) { |
30 | 30 | if (!$response->hasHeader('Content-Encoding') || $response->getHeader('Content-Encoding')[0] !== 'gzip') { |
31 | 31 | throw new ValidationFailedException('gzip compression not active'); |
@@ -36,12 +36,12 @@ |
||
36 | 36 | if ($cookieCount > $this->maxCookies) { |
37 | 37 | $result = new CheckResult( |
38 | 38 | CheckResult::STATUS_FAILURE, |
39 | - $cookieCount . ' cookies were stored (limit was ' . $this->maxCookies . ').', |
|
39 | + $cookieCount.' cookies were stored (limit was '.$this->maxCookies.').', |
|
40 | 40 | $cookieCount); |
41 | 41 | } else { |
42 | 42 | $result = new CheckResult( |
43 | 43 | CheckResult::STATUS_SUCCESS, |
44 | - $cookieCount . ' cookies were stored (limit was ' . $this->maxCookies . ').', |
|
44 | + $cookieCount.' cookies were stored (limit was '.$this->maxCookies.').', |
|
45 | 45 | $cookieCount); |
46 | 46 | } |
47 | 47 |
@@ -30,19 +30,19 @@ |
||
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 | 43 | protected function renderSkipped(CheckResult $result) |
44 | 44 | { |
45 | - $this->output->writeln(' <comment> ' . (string) $result->getResponse()->getUri() . ' </comment>test skipped'); |
|
46 | - $this->output->writeln(' - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']'); |
|
45 | + $this->output->writeln(' <comment> '.(string) $result->getResponse()->getUri().' </comment>test skipped'); |
|
46 | + $this->output->writeln(' - '.$result->getMessage().' [rule: '.$result->getRuleName().']'); |
|
47 | 47 | } |
48 | 48 | } |
@@ -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()); |