@@ -27,13 +27,13 @@ |
||
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
30 | - $htmlDocument = new Document((string)$response->getBody()); |
|
30 | + $htmlDocument = new Document((string) $response->getBody()); |
|
31 | 31 | |
32 | 32 | $resources = $htmlDocument->getDependencies($uri, false); |
33 | 33 | |
34 | 34 | foreach ($resources as $resource) { |
35 | 35 | if ($resource->getScheme() && 'https' !== $resource->getScheme()) { |
36 | - throw new ValidationFailedException('At least one dependency was found on a secure url, that was transfered insecure (' . (string)$resource . ')'); |
|
36 | + throw new ValidationFailedException('At least one dependency was found on a secure url, that was transfered insecure ('.(string) $resource.')'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
@@ -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); |
@@ -108,20 +108,20 @@ discard block |
||
108 | 108 | if (strpos($corruptUrl, '/') === 0) { |
109 | 109 | |
110 | 110 | $mainUri = $request->getUri(); |
111 | - $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri; |
|
111 | + $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri; |
|
112 | 112 | |
113 | - $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
114 | - $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
113 | + $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
114 | + $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
115 | 115 | |
116 | 116 | return $this->next(); |
117 | 117 | } |
118 | 118 | |
119 | 119 | // the error handling should be done withing the calling class |
120 | - echo "\n " . $exception->getMessage() . "\n"; |
|
120 | + echo "\n ".$exception->getMessage()."\n"; |
|
121 | 121 | |
122 | 122 | return $this->next(); |
123 | 123 | } else { |
124 | - $errorMessages .= $exception->getMessage() . "\n"; |
|
124 | + $errorMessages .= $exception->getMessage()."\n"; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | if ($errorMessages !== '') { |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | public function getOriginUri(UriInterface $uri) |
140 | 140 | { |
141 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
142 | - return $this->urls[$this->redirects[(string)$uri]]['url']; |
|
141 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
142 | + return $this->urls[$this->redirects[(string) $uri]]['url']; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return $uri; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | |
153 | 153 | public function getSystem(UriInterface $uri) |
154 | 154 | { |
155 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
156 | - return $this->urls[$this->redirects[(string)$uri]]['system']; |
|
155 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
156 | + return $this->urls[$this->redirects[(string) $uri]]['system']; |
|
157 | 157 | } |
158 | 158 | |
159 | - return $this->urls[(string)$uri]['system']; |
|
159 | + return $this->urls[(string) $uri]['system']; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | public function getSystems() |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | - * @param array $attributes |
|
48 | + * @param array $attribute |
|
49 | 49 | */ |
50 | 50 | public function addAttribute(Attribute $attribute) |
51 | 51 | { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | - * @return mixed |
|
72 | + * @return string |
|
73 | 73 | */ |
74 | 74 | public function getMessage() |
75 | 75 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | - * @param Response $response |
|
88 | + * @param ResponseInterface $response |
|
89 | 89 | */ |
90 | 90 | public function setResponse(ResponseInterface $response) |
91 | 91 | { |
@@ -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)); |