@@ -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 | } |
@@ -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) { |
@@ -30,18 +30,18 @@ |
||
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
33 | - $filename = $this->tmpDir . DIRECTORY_SEPARATOR . md5((string)$response->getBody()) . '.js'; |
|
34 | - file_put_contents($filename, (string)$response->getBody()); |
|
35 | - $conf = __DIR__ . DIRECTORY_SEPARATOR . 'jsHint.conf'; |
|
33 | + $filename = $this->tmpDir.DIRECTORY_SEPARATOR.md5((string) $response->getBody()).'.js'; |
|
34 | + file_put_contents($filename, (string) $response->getBody()); |
|
35 | + $conf = __DIR__.DIRECTORY_SEPARATOR.'jsHint.conf'; |
|
36 | 36 | |
37 | - $command = $this->jsHintExecutable . ' --config ' . $conf . ' --verbose ' . $filename . ' | grep -E E[0-9]+.$'; |
|
37 | + $command = $this->jsHintExecutable.' --config '.$conf.' --verbose '.$filename.' | grep -E E[0-9]+.$'; |
|
38 | 38 | $validationResult = shell_exec($command); |
39 | 39 | |
40 | 40 | unlink($filename); |
41 | 41 | |
42 | 42 | if (!is_null($validationResult)) { |
43 | - $errorMsg = str_replace($filename . ':', '', $validationResult); |
|
44 | - throw new ValidationFailedException('JavaScript error found: ' . $errorMsg); |
|
43 | + $errorMsg = str_replace($filename.':', '', $validationResult); |
|
44 | + throw new ValidationFailedException('JavaScript error found: '.$errorMsg); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | protected function doValidation(ResponseInterface $response) |
26 | 26 | { |
27 | - $size = strlen((string)$response->getBody()) / 1000; |
|
28 | - $this->assert($size <= $this->maxSize, 'The size of the file is too big (' . $size . ' KB)'); |
|
27 | + $size = strlen((string) $response->getBody()) / 1000; |
|
28 | + $this->assert($size <= $this->maxSize, 'The size of the file is too big ('.$size.' KB)'); |
|
29 | 29 | } |
30 | 30 | } |