@@ -16,7 +16,6 @@ |
||
| 16 | 16 | protected $contentTypes = array('text/html', 'application/json', 'application/xml'); |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * @param int $string The string that the document must contain |
|
| 20 | 19 | */ |
| 21 | 20 | public function init(array $regExs) |
| 22 | 21 | { |
@@ -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>'; |
@@ -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) |