@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | public function init($filters = array(), $filterFile = '', $exclusive = array()) |
| 42 | 42 | { |
| 43 | 43 | if (count($exclusive) > 0 && (count($filters) > 0 || $filterFile !== '')) { |
| 44 | - throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: " . get_class($this) . '].'); |
|
| 44 | + throw new \RuntimeException("It's not possible to define filter lists and an exclusive list at the same time [Extension: ".get_class($this).'].'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ($filterFile !== '') { |
| 48 | 48 | if (!file_exists($filterFile)) { |
| 49 | - throw new \RuntimeException('Filter file not found: ' . $filterFile); |
|
| 49 | + throw new \RuntimeException('Filter file not found: '.$filterFile); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $filterElements = EnvAwareYaml::parse(file_get_contents($filterFile)); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function isFiltered(Event $event, $ruleName, UriAwareResponse $response) |
| 87 | 87 | { |
| 88 | - $uri = (string)$this->retriever->getOriginUri($response->getUri()); |
|
| 88 | + $uri = (string) $this->retriever->getOriginUri($response->getUri()); |
|
| 89 | 89 | |
| 90 | 90 | if ($this->currentModus === self::MODUS_FILTER) { |
| 91 | 91 | $isFiltered = $this->isFilteredByFilter($ruleName, $uri); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | private function isFilteredByFilter($ruleName, $uri) |
| 105 | 105 | { |
| 106 | 106 | foreach ($this->filters as $filter) { |
| 107 | - if ($ruleName === $filter['rule'] && 0 < preg_match('$' . $filter['uri'] . '$', $uri)) { |
|
| 107 | + if ($ruleName === $filter['rule'] && 0 < preg_match('$'.$filter['uri'].'$', $uri)) { |
|
| 108 | 108 | return true; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $failures = 0; |
| 60 | 60 | |
| 61 | 61 | if ($this->retriever instanceof CrawlingRetriever) { |
| 62 | - $startPage = (string)$this->retriever->getStartPage(); |
|
| 62 | + $startPage = (string) $this->retriever->getStartPage(); |
|
| 63 | 63 | } else { |
| 64 | 64 | $startPage = ''; |
| 65 | 65 | } |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | $testCase->addFailure(new Failure($ruleName, $message)); |
| 81 | 81 | |
| 82 | 82 | if ($this->retriever instanceof CrawlingRetriever) { |
| 83 | - $stackTrace = $result->getUrl() . ' coming from ' . (string)$this->retriever->getComingFrom($result->getUrl()) . PHP_EOL; |
|
| 84 | - $stackTrace .= ' - ' . $message . " [rule: $ruleName]"; |
|
| 83 | + $stackTrace = $result->getUrl().' coming from '.(string) $this->retriever->getComingFrom($result->getUrl()).PHP_EOL; |
|
| 84 | + $stackTrace .= ' - '.$message." [rule: $ruleName]"; |
|
| 85 | 85 | $testCase->setSystemOut($stackTrace); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | file_put_contents($this->filename, $xUnitReport->toXml()); |
| 94 | 94 | |
| 95 | - $this->output->writeln(' <info>Writing XUnit Output to file:</info> ' . $this->filename); |
|
| 95 | + $this->output->writeln(' <info>Writing XUnit Output to file:</info> '.$this->filename); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function processResults($results) |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | if ($response instanceof ContentTypeAwareResponse) { |
| 25 | 25 | if (strpos($response->getContentType(), 'image') === false |
| 26 | 26 | && strpos($response->getContentType(), 'pdf') === false |
| 27 | - && strlen((string)$response->getBody()) >= $this->minFileSize |
|
| 27 | + && strlen((string) $response->getBody()) >= $this->minFileSize |
|
| 28 | 28 | ) { |
| 29 | 29 | if (!$response->hasHeader('Content-Encoding') || $response->getHeader('Content-Encoding')[0] !== 'gzip') { |
| 30 | 30 | throw new ValidationFailedException('gzip compression not active'); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | public function validate(ResponseInterface $response) |
| 23 | 23 | { |
| 24 | 24 | if ($response->getStatusCode() > $this->maxStatusCode) { |
| 25 | - throw new ValidationFailedException('Status code ' . $response->getStatusCode() . ' found.'); |
|
| 25 | + throw new ValidationFailedException('Status code '.$response->getStatusCode().' found.'); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function validate(ResponseInterface $response) |
| 27 | 27 | { |
| 28 | 28 | if ($response->getStatusCode() !== $this->expectedStatus) { |
| 29 | - throw new ValidationFailedException('Status code ' . $response->getStatusCode() . ' found, ' . $this->expectedStatus . ' expected.'); |
|
| 29 | + throw new ValidationFailedException('Status code '.$response->getStatusCode().' found, '.$this->expectedStatus.' expected.'); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -29,14 +29,14 @@ |
||
| 29 | 29 | if ($response->getDuration() > $this->maxDuration) { |
| 30 | 30 | return new CheckResult( |
| 31 | 31 | CheckResult::STATUS_FAILURE, |
| 32 | - 'The http request took ' . (int)$response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).', |
|
| 33 | - (int)$response->getDuration()); |
|
| 32 | + 'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).', |
|
| 33 | + (int) $response->getDuration()); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | return new CheckResult( |
| 37 | 37 | CheckResult::STATUS_SUCCESS, |
| 38 | - 'The http request took ' . (int)$response->getDuration() . ' milliseconds.', |
|
| 39 | - (int)$response->getDuration()); |
|
| 38 | + 'The http request took '.(int) $response->getDuration().' milliseconds.', |
|
| 39 | + (int) $response->getDuration()); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | protected function doValidation(ResponseInterface $response) |
| 28 | 28 | { |
| 29 | - $document = new Document((string)$response->getBody()); |
|
| 29 | + $document = new Document((string) $response->getBody()); |
|
| 30 | 30 | $files = $this->getFilesToCount($document, $response); |
| 31 | 31 | |
| 32 | 32 | $this->assert(count($files) <= $this->maxCount, sprintf($this->errorMessage, count($files))); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function doValidation(ResponseInterface $response) |
| 23 | 23 | { |
| 24 | 24 | $domDocument = new \DOMDocument(); |
| 25 | - @$domDocument->loadHTML((string)$response->getBody()); |
|
| 25 | + @$domDocument->loadHTML((string) $response->getBody()); |
|
| 26 | 26 | |
| 27 | 27 | $domXPath = new \DOMXPath($domDocument); |
| 28 | 28 | |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | $count = $domXPath->query($xpath['pattern'])->length; |
| 31 | 31 | |
| 32 | 32 | if ($xpath['relation'] === 'equals') { |
| 33 | - $result = $count === (int)$xpath['value']; |
|
| 34 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were exact ' . $xpath['value'] . ' occurencies.'; |
|
| 33 | + $result = $count === (int) $xpath['value']; |
|
| 34 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were exact '.$xpath['value'].' occurencies.'; |
|
| 35 | 35 | } elseif ($xpath['relation'] === 'less than') { |
| 36 | - $result = $count < (int)$xpath['value']; |
|
| 37 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were less than ' . $xpath['value'] . '.'; |
|
| 36 | + $result = $count < (int) $xpath['value']; |
|
| 37 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were less than '.$xpath['value'].'.'; |
|
| 38 | 38 | } elseif ($xpath['relation'] === 'greater than') { |
| 39 | - $result = $count > (int)$xpath['value']; |
|
| 40 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were more than ' . $xpath['value'] . '.'; |
|
| 39 | + $result = $count > (int) $xpath['value']; |
|
| 40 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were more than '.$xpath['value'].'.'; |
|
| 41 | 41 | } else { |
| 42 | - throw new \RuntimeException('Relation not defined. Given "' . $xpath['relation'] . '" expected [equals, greater than, less than]'); |
|
| 42 | + throw new \RuntimeException('Relation not defined. Given "'.$xpath['relation'].'" expected [equals, greater than, less than]'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $this->assert($result, $message); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public function doValidation(ResponseInterface $response) |
| 25 | 25 | { |
| 26 | 26 | $domDocument = new \DOMDocument(); |
| 27 | - @$domDocument->loadHTML((string)$response->getBody()); |
|
| 27 | + @$domDocument->loadHTML((string) $response->getBody()); |
|
| 28 | 28 | |
| 29 | 29 | $domXPath = new \DOMXPath($domDocument); |
| 30 | 30 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | try { |
| 38 | 38 | $selectorAsXPath = $converter->toXPath($selector['pattern']); |
| 39 | 39 | } catch (\Exception $e) { |
| 40 | - throw new ValidationFailedException('Invalid css selector (' . $selector['pattern'] . ').'); |
|
| 40 | + throw new ValidationFailedException('Invalid css selector ('.$selector['pattern'].').'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $count = $domXPath->query($selectorAsXPath)->length; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if ($error === true) { |
| 52 | 52 | $allNotFoundSelectors = implode('", "', $snotFoundSelectors); |
| 53 | 53 | |
| 54 | - throw new ValidationFailedException('CSS Selector "' . $allNotFoundSelectors . '" not found in DOM.'); |
|
| 54 | + throw new ValidationFailedException('CSS Selector "'.$allNotFoundSelectors.'" not found in DOM.'); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | } |