@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - $crawler = new Crawler((string)$response->getBody()); |
|
| 21 | + $crawler = new Crawler((string) $response->getBody()); |
|
| 22 | 22 | |
| 23 | 23 | $idList = $crawler->filterXPath('//*[@id!=""]'); |
| 24 | 24 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | if (count($duplicatedIds) > 0) { |
| 38 | 38 | unset($duplicatedIds['']); |
| 39 | - throw new ValidationFailedException('Duplicate ids found (' . implode(', ', array_keys($duplicatedIds)) . ')'); |
|
| 39 | + throw new ValidationFailedException('Duplicate ids found ('.implode(', ', array_keys($duplicatedIds)).')'); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function doValidation(ResponseInterface $response) |
| 28 | 28 | { |
| 29 | - $result = json_decode((string)$response->getBody()); |
|
| 29 | + $result = json_decode((string) $response->getBody()); |
|
| 30 | 30 | if ($result === null) { |
| 31 | - throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "')."); |
|
| 31 | + throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."')."); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 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 | $images = $document->getImages($response->getUri()); |
| 31 | 31 | |
| 32 | 32 | $foreignImages = array(); |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | foreach ($images as $image) { |
| 38 | 38 | /* @var $image Uri */ |
| 39 | 39 | if ($currentUri->getHost($this->depth) !== $image->getHost($this->depth)) { |
| 40 | - $foreignImages[] = (string)$image; |
|
| 40 | + $foreignImages[] = (string) $image; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $this->assert(count($foreignImages) === 0, 'Images from a foreign domain where found (' . implode(', ', $foreignImages) . ')'); |
|
| 44 | + $this->assert(count($foreignImages) === 0, 'Images from a foreign domain where found ('.implode(', ', $foreignImages).')'); |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -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 lengh: ' . strlen((string)$response->getBody()) . ').'); |
|
| 19 | + if (stripos((string) $response->getBody(), '</html>') === false) { |
|
| 20 | + throw new ValidationFailedException('Closing html tag is missing (document lengh: '.strlen((string) $response->getBody()).').'); |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | protected function doValidation(ResponseInterface $response) |
| 20 | 20 | { |
| 21 | - $document = new Document((string)$response->getBody(), false); |
|
| 21 | + $document = new Document((string) $response->getBody(), false); |
|
| 22 | 22 | |
| 23 | 23 | $urls = $document->getDependencies($response->getUri()); |
| 24 | 24 | |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | foreach ($urls as $url) { |
| 29 | 29 | |
| 30 | - $idnUrl = $url->getScheme() . '://' . idn_to_ascii($url->getHost()) . $url->getPath(); |
|
| 30 | + $idnUrl = $url->getScheme().'://'.idn_to_ascii($url->getHost()).$url->getPath(); |
|
| 31 | 31 | |
| 32 | 32 | if (!filter_var($idnUrl, FILTER_VALIDATE_URL)) { |
| 33 | - $invalidUrls[] = (string)$url; |
|
| 33 | + $invalidUrls[] = (string) $url; |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $this->assert(count($invalidUrls) === 0, 'Invalid urls found (' . implode(', ', $invalidUrls) . ').'); |
|
| 37 | + $this->assert(count($invalidUrls) === 0, 'Invalid urls found ('.implode(', ', $invalidUrls).').'); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | protected function doValidation(ResponseInterface $response) |
| 27 | 27 | { |
| 28 | - $size = strlen((string)$response->getBody()) / 1000; |
|
| 29 | - $this->assert($size <= $this->maxSize, 'The size of this html file is too big (' . $size . ' KB)'); |
|
| 28 | + $size = strlen((string) $response->getBody()) / 1000; |
|
| 29 | + $this->assert($size <= $this->maxSize, 'The size of this html file is too big ('.$size.' KB)'); |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function doValidation(ResponseInterface $response) |
| 26 | 26 | { |
| 27 | - $this->assert(strpos((string)$response->getBody(), $this->string) !== false, |
|
| 28 | - 'The given string (' . $this->string . ') was found in this document.'); |
|
| 27 | + $this->assert(strpos((string) $response->getBody(), $this->string) !== false, |
|
| 28 | + 'The given string ('.$this->string.') was found in this document.'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | protected function doValidation(ResponseInterface $response) |
| 26 | 26 | { |
| 27 | - $this->assert(strpos((string)$response->getBody(), $this->string) !== false, |
|
| 28 | - 'The given string (' . $this->string . ') was not found in this document.'); |
|
| 27 | + $this->assert(strpos((string) $response->getBody(), $this->string) !== false, |
|
| 28 | + 'The given string ('.$this->string.') was not found in this document.'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | return; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - $crawler = new Crawler((string)$response->getBody()); |
|
| 23 | + $crawler = new Crawler((string) $response->getBody()); |
|
| 24 | 24 | $metaTags = $crawler->filterXPath("//meta[@name='robots']/@content"); |
| 25 | 25 | |
| 26 | 26 | foreach ($metaTags as $metaTag) { |