@@ -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 | } |
@@ -36,12 +36,12 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | if ($totalSize > $this->maxSize) { |
39 | - $message = 'The total size of the file (and all assets) was ' . $totalSize . ' KB (max: ' . $this->maxSize . ' KB).'; |
|
39 | + $message = 'The total size of the file (and all assets) was '.$totalSize.' KB (max: '.$this->maxSize.' KB).'; |
|
40 | 40 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $message, $totalSize); |
41 | 41 | $result->addAttribute(new Attribute('resources', $response->getResources(), true)); |
42 | 42 | return $result; |
43 | 43 | } else { |
44 | - $message = 'The total size of the file (and all assets) was ' . $totalSize . ' KB (max: ' . $this->maxSize . ' KB).'; |
|
44 | + $message = 'The total size of the file (and all assets) was '.$totalSize.' KB (max: '.$this->maxSize.' KB).'; |
|
45 | 45 | $result = new CheckResult(CheckResult::STATUS_SUCCESS, $message, $totalSize); |
46 | 46 | $result->addAttribute(new Attribute('resources', $response->getResources(), true)); |
47 | 47 | return $result; |
@@ -38,9 +38,9 @@ |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | if (count($bigFiles) > 0) { |
41 | - $message = "Some files were found that are too big (max: " . $this->maxElementSize . " KB):<ul>"; |
|
41 | + $message = "Some files were found that are too big (max: ".$this->maxElementSize." KB):<ul>"; |
|
42 | 42 | foreach ($bigFiles as $bigFile) { |
43 | - $message .= '<li>File: ' . $bigFile['name'] . ', Size: ' . $bigFile['size'] . ' KB</li>'; |
|
43 | + $message .= '<li>File: '.$bigFile['name'].', Size: '.$bigFile['size'].' KB</li>'; |
|
44 | 44 | } |
45 | 45 | $message .= "</ul>"; |
46 | 46 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $message, count($bigFiles)); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | public function init($command) |
13 | 13 | { |
14 | - $this->callback = function () use ($command) { |
|
14 | + $this->callback = function() use ($command) { |
|
15 | 15 | return eval($command); |
16 | 16 | }; |
17 | 17 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | public function init($maxElements = 200) |
22 | 22 | { |
23 | - $this->maxElements = (int)$maxElements; |
|
23 | + $this->maxElements = (int) $maxElements; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | protected function doValidation(ResponseInterface $response) |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | if ($response instanceof ResourcesAwareResponse) { |
29 | 29 | $resourceCount = count($response->getResources()); |
30 | 30 | if ($resourceCount > $this->maxElements) { |
31 | - $message = 'Too many resources were loaded. ' . $resourceCount . ' resources loaded, maximum was ' . $this->maxElements . '.'; |
|
31 | + $message = 'Too many resources were loaded. '.$resourceCount.' resources loaded, maximum was '.$this->maxElements.'.'; |
|
32 | 32 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $message, $resourceCount); |
33 | 33 | $result->addAttribute(new Attribute('resources', $response->getResources(), true)); |
34 | 34 | return $result; |
35 | 35 | } else { |
36 | - $message = $resourceCount . ' resources were loaded.'; |
|
36 | + $message = $resourceCount.' resources were loaded.'; |
|
37 | 37 | return new CheckResult(CheckResult::STATUS_SUCCESS, $message, $resourceCount); |
38 | 38 | } |
39 | 39 | } else { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | protected function doValidation(ResponseInterface $response) |
24 | 24 | { |
25 | - $body = (string)$response->getBody(); |
|
25 | + $body = (string) $response->getBody(); |
|
26 | 26 | |
27 | 27 | $dom = new \DOMDocument(); |
28 | 28 | @$dom->loadXML($body); |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | $error = true; |
38 | 38 | $lastError = libxml_get_last_error(); |
39 | 39 | |
40 | - $messageParts[] = $xsdFile['xsdfilename'] . ' - ' . $xsdFile['xsdfileurl'] . ' (last error: ' . str_replace("\n", '', $lastError->message) . ').'; |
|
40 | + $messageParts[] = $xsdFile['xsdfilename'].' - '.$xsdFile['xsdfileurl'].' (last error: '.str_replace("\n", '', $lastError->message).').'; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | if ($error === true) { |
45 | - $message = 'XML file (' . (string)$response->getUri() . ') does not validate against the following XSD files: ' . implode(', ', $messageParts); |
|
45 | + $message = 'XML file ('.(string) $response->getUri().') does not validate against the following XSD files: '.implode(', ', $messageParts); |
|
46 | 46 | throw new ValidationFailedException($message); |
47 | 47 | } |
48 | 48 | } |