@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } else { |
50 | 50 | $uri = new Uri($url); |
51 | 51 | } |
52 | - $this->urls[(string)$uri] = ['url' => $uri, 'system' => $key]; |
|
52 | + $this->urls[(string) $uri] = ['url' => $uri, 'system' => $key]; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | $this->urlStack = $this->urls; |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | if (strpos($corruptUrl, '/') === 0) { |
110 | 110 | |
111 | 111 | $mainUri = $request->getUri(); |
112 | - $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri; |
|
112 | + $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri; |
|
113 | 113 | |
114 | - $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
115 | - $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
114 | + $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
115 | + $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
116 | 116 | |
117 | 117 | return $this->next(); |
118 | 118 | } |
119 | 119 | |
120 | 120 | // the error handling should be done withing the calling class |
121 | - echo "\n " . $exception->getMessage() . "\n"; |
|
121 | + echo "\n ".$exception->getMessage()."\n"; |
|
122 | 122 | |
123 | 123 | return $this->next(); |
124 | 124 | } else { |
125 | - $errorMessages .= $exception->getMessage() . "\n"; |
|
125 | + $errorMessages .= $exception->getMessage()."\n"; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | if ($errorMessages !== '') { |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | public function getOriginUri(UriInterface $uri) |
141 | 141 | { |
142 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
143 | - return $this->urls[$this->redirects[(string)$uri]]['url']; |
|
142 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
143 | + return $this->urls[$this->redirects[(string) $uri]]['url']; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $uri; |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | |
154 | 154 | public function getSystem(UriInterface $uri) |
155 | 155 | { |
156 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
157 | - return $this->urls[$this->redirects[(string)$uri]]['system']; |
|
156 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
157 | + return $this->urls[$this->redirects[(string) $uri]]['system']; |
|
158 | 158 | } |
159 | 159 | |
160 | - return $this->urls[(string)$uri]['system']; |
|
160 | + return $this->urls[(string) $uri]['system']; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | public function getSystems() |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | public function init($filters = array(), $filterFile = '', $exclusive = array()) |
43 | 43 | { |
44 | 44 | if (count($exclusive) > 0 && (count($filters) > 0 || $filterFile !== '')) { |
45 | - throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: " . get_class($this) . '].'); |
|
45 | + throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: ".get_class($this).'].'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | if ($filterFile !== '') { |
49 | 49 | if (!file_exists($filterFile)) { |
50 | - throw new \RuntimeException('Filter file not found: ' . $filterFile); |
|
50 | + throw new \RuntimeException('Filter file not found: '.$filterFile); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $filterElements = EnvAwareYaml::parse(file_get_contents($filterFile)); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if (is_array($urls)) { |
73 | 73 | foreach ($urls as $url) { |
74 | 74 | $uri = new Uri($url); |
75 | - $this->exclusives[$rule][] = (string)$uri; |
|
75 | + $this->exclusives[$rule][] = (string) $uri; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function isFiltered(Event $event, $ruleName, UriAwareResponse $response) |
95 | 95 | { |
96 | - $uri = (string)$this->retriever->getOriginUri($response->getUri()); |
|
96 | + $uri = (string) $this->retriever->getOriginUri($response->getUri()); |
|
97 | 97 | |
98 | 98 | if ($this->currentModus === self::MODUS_FILTER) { |
99 | 99 | $isFiltered = $this->isFilteredByFilter($ruleName, $uri); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | private function isFilteredByFilter($ruleName, $uri) |
113 | 113 | { |
114 | 114 | foreach ($this->filters as $filter) { |
115 | - if ($ruleName === $filter['rule'] && 0 < preg_match('$' . $filter['uri'] . '$', $uri)) { |
|
115 | + if ($ruleName === $filter['rule'] && 0 < preg_match('$'.$filter['uri'].'$', $uri)) { |
|
116 | 116 | return true; |
117 | 117 | } |
118 | 118 | } |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | if ($regEx['isRegEx']) { |
43 | 43 | $pattern = str_replace('', '\\~', $regEx['pattern']); |
44 | 44 | |
45 | - if (preg_match('~' . $pattern . '~', (string)$response->getBody()) === 0) { |
|
46 | - $errors[] = 'Regular expression: ' . $regEx['pattern']; |
|
45 | + if (preg_match('~'.$pattern.'~', (string) $response->getBody()) === 0) { |
|
46 | + $errors[] = 'Regular expression: '.$regEx['pattern']; |
|
47 | 47 | } |
48 | 48 | } else { |
49 | - if (preg_match('^' . preg_quote($regEx['pattern']) . '^', (string)$response->getBody()) === 0) { |
|
50 | - $errors[] = 'Text: ' . $regEx['pattern']; |
|
49 | + if (preg_match('^'.preg_quote($regEx['pattern']).'^', (string) $response->getBody()) === 0) { |
|
50 | + $errors[] = 'Text: '.$regEx['pattern']; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $errorString = 'The following text elements were not found: <ul>'; |
57 | 57 | |
58 | 58 | foreach ($errors as $error) { |
59 | - $errorString .= '<li>' . $error . '</li>'; |
|
59 | + $errorString .= '<li>'.$error.'</li>'; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $errorString .= '</ul>'; |
@@ -16,8 +16,8 @@ |
||
16 | 16 | { |
17 | 17 | if ($response instanceof ContentTypeAwareResponse) { |
18 | 18 | if (($response->getStatusCode() < 300 || $response->getStatusCode() >= 400) && $response->getContentType() === 'text/html') { |
19 | - if (stripos((string)$response->getBody(), '</html>') === false) { |
|
20 | - throw new ValidationFailedException('Closing html tag is missing (document length: ' . strlen((string)$response->getBody()) . ').'); |
|
19 | + if (stripos((string) $response->getBody(), '</html>') === false) { |
|
20 | + throw new ValidationFailedException('Closing html tag is missing (document length: '.strlen((string) $response->getBody()).').'); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | foreach ($this->results as $results) { |
125 | 125 | foreach ($results as $result) { |
126 | 126 | /* @var CheckResult $result */ |
127 | - $tool = 'Smoke' . $result->getRuleName(); |
|
127 | + $tool = 'Smoke'.$result->getRuleName(); |
|
128 | 128 | $checks[$tool][] = $result; |
129 | 129 | } |
130 | 130 | } |
@@ -136,19 +136,19 @@ discard block |
||
136 | 136 | continue; |
137 | 137 | } |
138 | 138 | |
139 | - $message = 'The smoke test for #system_name# failed (Rule: ' . $toolName . ').<ul>'; |
|
139 | + $message = 'The smoke test for #system_name# failed (Rule: '.$toolName.').<ul>'; |
|
140 | 140 | $status = Event::STATUS_SUCCESS; |
141 | 141 | $failureCount = 0; |
142 | - $identifier = $toolName . '_' . $this->system; |
|
142 | + $identifier = $toolName.'_'.$this->system; |
|
143 | 143 | |
144 | 144 | foreach ($results as $result) { |
145 | 145 | /** @var CheckResult $result */ |
146 | 146 | if ($result->getStatus() === CheckResult::STATUS_FAILURE) { |
147 | 147 | $comingFrom = ''; |
148 | 148 | if ($this->addComingFrom && $this->retriever->getComingFrom($result->getResponse()->getUri())) { |
149 | - $comingFrom = ', coming from: ' . $this->retriever->getComingFrom($result->getResponse()->getUri()); |
|
149 | + $comingFrom = ', coming from: '.$this->retriever->getComingFrom($result->getResponse()->getUri()); |
|
150 | 150 | } |
151 | - $message .= '<li>' . $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . $comingFrom . ')</li>'; |
|
151 | + $message .= '<li>'.$result->getMessage().' (url: '.(string) $result->getResponse()->getUri().$comingFrom.')</li>'; |
|
152 | 152 | ++$failureCount; |
153 | 153 | } |
154 | 154 | } |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $status = Event::STATUS_FAILURE; |
157 | 157 | $message .= '</ul>'; |
158 | 158 | $firstResult = array_pop($results); |
159 | - $attributes[] = new Attribute('html-content', (string)$firstResult->getResponse()->getBody(), true); |
|
159 | + $attributes[] = new Attribute('html-content', (string) $firstResult->getResponse()->getBody(), true); |
|
160 | 160 | } else { |
161 | - $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:' . $toolName . '].'; |
|
161 | + $message = 'All checks for system "#system_name#" succeeded [SmokeBasic:'.$toolName.'].'; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $this->send($identifier, $this->system, $message, $status, $failureCount, $this->tool, $this->system, $attributes); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | foreach ($results as $result) { |
172 | 172 | /* @var CheckResult $result */ |
173 | 173 | |
174 | - $identifier = '_' . $this->getIdentifier($result); |
|
174 | + $identifier = '_'.$this->getIdentifier($result); |
|
175 | 175 | $tool = $this->getPrefix($result->getRuleName()); |
176 | 176 | |
177 | 177 | $component = $this->getComponent($result->getRuleName()); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $attributes = array(); |
181 | 181 | if ($result->getStatus() == CheckResult::STATUS_FAILURE) { |
182 | - $body = (string)$result->getResponse()->getBody(); |
|
182 | + $body = (string) $result->getResponse()->getBody(); |
|
183 | 183 | if ($body == "") { |
184 | 184 | $attributes[] = new Attribute('html content', '<empty>'); |
185 | 185 | } else { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->send( |
204 | 204 | $identifier, |
205 | 205 | $currentSystem, |
206 | - $result->getMessage() . ' (url: ' . (string)$result->getResponse()->getUri() . ')', |
|
206 | + $result->getMessage().' (url: '.(string) $result->getResponse()->getUri().')', |
|
207 | 207 | $result->getStatus(), |
208 | 208 | $result->getValue(), |
209 | 209 | $tool, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | private function getIdentifier(CheckResult $result) |
218 | 218 | { |
219 | - return $this->tool . '_' . $result->getRuleName(); |
|
219 | + return $this->tool.'_'.$result->getRuleName(); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | private function getPrefix($string) |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | $this->reporter->sendEvent($event); |
248 | 248 | } catch (KoalamonException $e) { |
249 | 249 | $this->output->writeln("\n <error> Error sending result to leankoala. </error>"); |
250 | - $this->output->writeln(' Url: ' . $e->getUrl()); |
|
251 | - $this->output->writeln(' Payload: ' . $e->getPayload()); |
|
250 | + $this->output->writeln(' Url: '.$e->getUrl()); |
|
251 | + $this->output->writeln(' Payload: '.$e->getPayload()); |
|
252 | 252 | $this->output->writeln(""); |
253 | 253 | } catch (\Exception $e) { |
254 | 254 | $this->output->writeln($e->getMessage()); |