@@ -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); |
@@ -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 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function doValidation(ResponseInterface $response) |
56 | 56 | { |
57 | - $body = (string)$response->getBody(); |
|
57 | + $body = (string) $response->getBody(); |
|
58 | 58 | |
59 | 59 | $json = json_decode($body); |
60 | 60 | |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | |
74 | 74 | if ($jsonValue === false || (is_array($jsonValue) && empty($jsonValue))) { |
75 | 75 | $error = true; |
76 | - $noCorrectJsonPaths[] = $path['pattern'] . ' (JSON path not found)'; |
|
76 | + $noCorrectJsonPaths[] = $path['pattern'].' (JSON path not found)'; |
|
77 | 77 | } |
78 | - if ($this->checkRelation($path['relation'], (int)$path['value'], $count) === false) { |
|
78 | + if ($this->checkRelation($path['relation'], (int) $path['value'], $count) === false) { |
|
79 | 79 | $error = true; |
80 | - $noCorrectJsonPaths[] = $path['pattern'] . ' (' . $count . ' elements found, expected ' . $path['relation'] . ' ' . $path['value'] . ')'; |
|
80 | + $noCorrectJsonPaths[] = $path['pattern'].' ('.$count.' elements found, expected '.$path['relation'].' '.$path['value'].')'; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | 84 | if ($error === true) { |
85 | 85 | $allNoCorrectJsonPaths = implode('", "', $noCorrectJsonPaths); |
86 | - throw new ValidationFailedException('Disonances with JSON Paths "' . $allNoCorrectJsonPaths . '!'); |
|
86 | + throw new ValidationFailedException('Disonances with JSON Paths "'.$allNoCorrectJsonPaths.'!'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } else { |
32 | 32 | |
33 | 33 | if ($certInfo['validFrom_time_t'] > time() || $certInfo['validTo_time_t'] < time()) { |
34 | - $errorMessage = 'Certificate is expired. [' . $validFrom . ' - ' . $validTo . ']'; |
|
34 | + $errorMessage = 'Certificate is expired. ['.$validFrom.' - '.$validTo.']'; |
|
35 | 35 | |
36 | 36 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage); |
37 | 37 | $infoJson = json_encode($certInfo); |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | $result->addAttribute(new Attribute('certificate information', $infoJson, true)); |
42 | 42 | } |
43 | 43 | return $result; |
44 | - } elseif ($certInfo['validTo_time_t'] < strtotime('+' . $this->expireWarningTime . 'days')) { |
|
45 | - $errorMessage = 'Certificate warning, expires in less than ' . $this->expireWarningTime . ' days. Certificate expires at: ' . $validTo; |
|
44 | + } elseif ($certInfo['validTo_time_t'] < strtotime('+'.$this->expireWarningTime.'days')) { |
|
45 | + $errorMessage = 'Certificate warning, expires in less than '.$this->expireWarningTime.' days. Certificate expires at: '.$validTo; |
|
46 | 46 | |
47 | 47 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage); |
48 | 48 | $result->addAttribute(new Attribute('certificate information', json_encode($certInfo), true)); |
@@ -50,6 +50,6 @@ discard block |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next ' . $this->expireWarningTime . ' days. Expire date: ' . $validTo . '.'); |
|
53 | + return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next '.$this->expireWarningTime.' days. Expire date: '.$validTo.'.'); |
|
54 | 54 | } |
55 | 55 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } else { |
50 | 50 | $uri = new Uri($url); |
51 | 51 | } |
52 | - $this->urls[(string)$uri] = ['url' => $uri, 'system' => $key]; |
|
52 | + $this->urls[(string) $uri] = ['url' => $uri, 'system' => $key]; |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | $this->urlStack = $this->urls; |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | if (strpos($corruptUrl, '/') === 0) { |
110 | 110 | |
111 | 111 | $mainUri = $request->getUri(); |
112 | - $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri; |
|
112 | + $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri; |
|
113 | 113 | |
114 | - $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
115 | - $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
114 | + $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
115 | + $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
116 | 116 | |
117 | 117 | return $this->next(); |
118 | 118 | } |
119 | 119 | |
120 | 120 | // the error handling should be done withing the calling class |
121 | - echo "\n " . $exception->getMessage() . "\n"; |
|
121 | + echo "\n ".$exception->getMessage()."\n"; |
|
122 | 122 | |
123 | 123 | return $this->next(); |
124 | 124 | } else { |
125 | - $errorMessages .= $exception->getMessage() . "\n"; |
|
125 | + $errorMessages .= $exception->getMessage()."\n"; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | if ($errorMessages !== '') { |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | public function getOriginUri(UriInterface $uri) |
141 | 141 | { |
142 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
143 | - return $this->urls[$this->redirects[(string)$uri]]['url']; |
|
142 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
143 | + return $this->urls[$this->redirects[(string) $uri]]['url']; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $uri; |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | |
154 | 154 | public function getSystem(UriInterface $uri) |
155 | 155 | { |
156 | - if (array_key_exists((string)$uri, $this->redirects)) { |
|
157 | - return $this->urls[$this->redirects[(string)$uri]]['system']; |
|
156 | + if (array_key_exists((string) $uri, $this->redirects)) { |
|
157 | + return $this->urls[$this->redirects[(string) $uri]]['system']; |
|
158 | 158 | } |
159 | 159 | |
160 | - return $this->urls[(string)$uri]['system']; |
|
160 | + return $this->urls[(string) $uri]['system']; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | public function getSystems() |