@@ -11,10 +11,10 @@ |
||
| 11 | 11 | preg_match_all('^\${(.*)}^', $fileContent, $matches); |
| 12 | 12 | foreach ($matches[1] as $varName) { |
| 13 | 13 | if (!getenv($varName)) { |
| 14 | - throw new \RuntimeException('The mandatory env variable (' . $varName . ') from the config file was not set.'); |
|
| 14 | + throw new \RuntimeException('The mandatory env variable ('.$varName.') from the config file was not set.'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - $fileContent = str_replace('${' . $varName . '}', getenv($varName), $fileContent); |
|
| 17 | + $fileContent = str_replace('${'.$varName.'}', getenv($varName), $fileContent); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | return Yaml::parse($fileContent); |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | public function validate(Response $response) |
| 15 | 15 | { |
| 16 | - $url = $response->getUri()->getScheme() . '://' . $response->getUri()->getHost(); |
|
| 16 | + $url = $response->getUri()->getScheme().'://'.$response->getUri()->getHost(); |
|
| 17 | 17 | |
| 18 | 18 | if (substr_count($url, '/') === 2) { |
| 19 | - $filename = $robotsUrl = $url . '/robots.txt'; |
|
| 19 | + $filename = $robotsUrl = $url.'/robots.txt'; |
|
| 20 | 20 | } elseif (substr_count($url, '/') === 3) { |
| 21 | - $filename = $robotsUrl = $url . 'robots.txt'; |
|
| 21 | + $filename = $robotsUrl = $url.'robots.txt'; |
|
| 22 | 22 | } else { |
| 23 | 23 | return; |
| 24 | 24 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $content = file_get_contents($filename); |
| 30 | 30 | $normalizedContent = str_replace(' ', '', $content); |
| 31 | 31 | |
| 32 | - if (strpos($normalizedContent, 'Disallow:/' . PHP_EOL) !== false) { |
|
| 32 | + if (strpos($normalizedContent, 'Disallow:/'.PHP_EOL) !== false) { |
|
| 33 | 33 | throw new ValidationFailedException('The robots.txt contains disallow all (Disallow: /)'); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -30,18 +30,18 @@ |
||
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $filename = $this->tmpDir . DIRECTORY_SEPARATOR . md5($response->getBody()) . '.js'; |
|
| 33 | + $filename = $this->tmpDir.DIRECTORY_SEPARATOR.md5($response->getBody()).'.js'; |
|
| 34 | 34 | file_put_contents($filename, $response->getBody()); |
| 35 | - $conf = __DIR__ . DIRECTORY_SEPARATOR . 'jsHint.conf'; |
|
| 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 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function validate(Response $response) |
| 26 | 26 | { |
| 27 | 27 | if ($response->getDuration() > $this->maxDuration) { |
| 28 | - throw new ValidationFailedException('the http request lasted ' . $response->getDuration() . ' milliseconds.'); |
|
| 28 | + throw new ValidationFailedException('the http request lasted '.$response->getDuration().' milliseconds.'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -22,13 +22,13 @@ |
||
| 22 | 22 | { |
| 23 | 23 | foreach ($this->checkedHeaders as $headerConfig) { |
| 24 | 24 | if (!$response->hasHeader($headerConfig['key'])) { |
| 25 | - throw new ValidationFailedException('Header not found (' . $headerConfig['key'] . ')'); |
|
| 25 | + throw new ValidationFailedException('Header not found ('.$headerConfig['key'].')'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $currentValue = $response->getHeader($headerConfig['key'])[0]; |
| 29 | 29 | |
| 30 | 30 | if ($currentValue !== $headerConfig['value']) { |
| 31 | - throw new ValidationFailedException('Header "' . $headerConfig['key'] . '" does not equal "' . $headerConfig['value'] . '". Current value is "' . $currentValue . '"'); |
|
| 31 | + throw new ValidationFailedException('Header "'.$headerConfig['key'].'" does not equal "'.$headerConfig['value'].'". Current value is "'.$currentValue.'"'); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function validate(Response $response) |
| 22 | 22 | { |
| 23 | 23 | if ($response->getStatus() > $this->maxStatusCode) { |
| 24 | - throw new ValidationFailedException('Status code ' . $response->getStatus() . ' found.'); |
|
| 24 | + throw new ValidationFailedException('Status code '.$response->getStatus().' found.'); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function validate(Response $response) |
| 26 | 26 | { |
| 27 | 27 | if ($response->getStatus() !== $this->expectedStatus) { |
| 28 | - throw new ValidationFailedException('Status code ' . $response->getStatus() . ' found, ' . $this->expectedStatus . ' expected.'); |
|
| 28 | + throw new ValidationFailedException('Status code '.$response->getStatus().' found, '.$this->expectedStatus.' expected.'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | protected function doValidation(Response $response) |
| 27 | 27 | { |
| 28 | 28 | $size = strlen($response->getBody()) / 1000; |
| 29 | - $this->assert($size <= $this->maxSize, 'The size of this html file is too big (' . $size . ' KB)'); |
|
| 29 | + $this->assert($size <= $this->maxSize, 'The size of this html file is too big ('.$size.' KB)'); |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -41,6 +41,6 @@ |
||
| 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 | } |