@@ -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 | } |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | protected function writeSmokeCredentials($url = null) |
| 58 | 58 | { |
| 59 | - $this->output->writeln("\n Smoke " . SMOKE_VERSION . " by Nils Langner\n"); |
|
| 59 | + $this->output->writeln("\n Smoke ".SMOKE_VERSION." by Nils Langner\n"); |
|
| 60 | 60 | |
| 61 | 61 | if ($url) { |
| 62 | - $this->output->writeln(' <info>Scanning ' . $url . "</info>\n"); |
|
| 62 | + $this->output->writeln(' <info>Scanning '.$url."</info>\n"); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | if ($configFile) { |
| 90 | 90 | if (strpos($configFile, 'http://') === 0 || strpos($configFile, 'https://') === 0) { |
| 91 | 91 | $curlClient = new Client(); |
| 92 | - $fileContent = (string)$curlClient->get($configFile)->getBody(); |
|
| 92 | + $fileContent = (string) $curlClient->get($configFile)->getBody(); |
|
| 93 | 93 | } else { |
| 94 | 94 | if (file_exists($configFile)) { |
| 95 | 95 | $fileContent = file_get_contents($configFile); |
| 96 | 96 | } else { |
| 97 | - throw new \RuntimeException("Config file was not found ('" . $configFile . "')."); |
|
| 97 | + throw new \RuntimeException("Config file was not found ('".$configFile."')."); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | $configArray = EnvAwareYaml::parse($fileContent); |