@@ -12,10 +12,10 @@ |
||
| 12 | 12 | |
| 13 | 13 | foreach ($matches[1] as $varName) { |
| 14 | 14 | if (!getenv($varName)) { |
| 15 | - throw new \RuntimeException('The mandatory env variable (' . $varName . ') from the config file was not set.'); |
|
| 15 | + throw new \RuntimeException('The mandatory env variable ('.$varName.') from the config file was not set.'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $fileContent = str_replace('${' . $varName . '}', getenv($varName), $fileContent); |
|
| 18 | + $fileContent = str_replace('${'.$varName.'}', getenv($varName), $fileContent); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | return Yaml::parse($fileContent); |
@@ -27,13 +27,13 @@ |
||
| 27 | 27 | if ($response->getDuration() > $this->maxDuration) { |
| 28 | 28 | return new CheckResult( |
| 29 | 29 | CheckResult::STATUS_FAILURE, |
| 30 | - 'The http request took ' . (int) $response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).', |
|
| 30 | + 'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).', |
|
| 31 | 31 | (int) $response->getDuration()); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | return new CheckResult( |
| 35 | 35 | CheckResult::STATUS_SUCCESS, |
| 36 | - 'The http request took ' . (int) $response->getDuration() . ' milliseconds.', |
|
| 36 | + 'The http request took '.(int) $response->getDuration().' milliseconds.', |
|
| 37 | 37 | (int) $response->getDuration()); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -25,13 +25,13 @@ |
||
| 25 | 25 | $validTo = date('d.m.Y H:i:s', $certInfo['validTo_time_t']); |
| 26 | 26 | |
| 27 | 27 | if ($certInfo['validFrom_time_t'] > time() || $certInfo['validTo_time_t'] < time()) { |
| 28 | - $errorMessage = 'Certificate is expired. [' . $validFrom . ' - ' . $validTo . ']'; |
|
| 28 | + $errorMessage = 'Certificate is expired. ['.$validFrom.' - '.$validTo.']'; |
|
| 29 | 29 | return new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage); |
| 30 | - } elseif ($certInfo['validTo_time_t'] < strtotime('+' . $this->expireWarningTime . 'days')) { |
|
| 31 | - $errorMessage = 'Certificate warning, expires in less than ' . $this->expireWarningTime . ' days. Certificate expires at: ' . $validTo; |
|
| 30 | + } elseif ($certInfo['validTo_time_t'] < strtotime('+'.$this->expireWarningTime.'days')) { |
|
| 31 | + $errorMessage = 'Certificate warning, expires in less than '.$this->expireWarningTime.' days. Certificate expires at: '.$validTo; |
|
| 32 | 32 | return new CheckResult(CheckResult::STATUS_FAILURE, $errorMessage, 0); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next ' . $this->expireWarningTime . ' days. Expire date: ' . $validTo . '.'); |
|
| 35 | + return new CheckResult(CheckResult::STATUS_SUCCESS, 'The certificate does not expire within the next '.$this->expireWarningTime.' days. Expire date: '.$validTo.'.'); |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -34,15 +34,15 @@ |
||
| 34 | 34 | ))); |
| 35 | 35 | |
| 36 | 36 | if (property_exists($result, 'error')) { |
| 37 | - throw new ValidationFailedException('Google mobile friendly test was not passed. Error "' . $result->error->message . '"'); |
|
| 37 | + throw new ValidationFailedException('Google mobile friendly test was not passed. Error "'.$result->error->message.'"'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $passResult = $result->ruleGroups->USABILITY; |
| 41 | 41 | |
| 42 | 42 | if (!$passResult->pass) { |
| 43 | - return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score ' . $passResult->score . '/100.', (int) $passResult->score); |
|
| 43 | + return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score ' . $passResult->score . '/100.', (int) $passResult->score); |
|
| 46 | + return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | if (count($results) > 0) { |
| 23 | 23 | ++$this->urlCount; |
| 24 | 24 | $firstResult = array_pop($results); |
| 25 | - $this->output->writeln(' ' . (string) $firstResult->getResponse()->getUri()); |
|
| 25 | + $this->output->writeln(' '.(string) $firstResult->getResponse()->getUri()); |
|
| 26 | 26 | $this->output->writeln(''); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function finish() |
| 31 | 31 | { |
| 32 | - $this->output->writeln(' <comment>Warm up finished. ' . $this->urlCount . ' urls visited.</comment>'); |
|
| 32 | + $this->output->writeln(' <comment>Warm up finished. '.$this->urlCount.' urls visited.</comment>'); |
|
| 33 | 33 | $this->output->writeln(''); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $data = json_decode($response->getBody()); |
| 36 | 36 | if ($data === null) { |
| 37 | - throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "')."); |
|
| 37 | + throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."')."); |
|
| 38 | 38 | } else { |
| 39 | 39 | $errorStatus = false; |
| 40 | 40 | $messageParts = array(); |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | $errorStatus = true; |
| 51 | 51 | $errorMessage = ''; |
| 52 | 52 | foreach ($validator->getErrors() as $error) { |
| 53 | - $errorMessage = $errorMessage . sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
| 53 | + $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
| 54 | 54 | } |
| 55 | - $messageParts[] = $jsonSchemaFile['jsonfilename'] . ' - ' . $jsonSchemaFile['jsonfileurl'] . '(last error: ' . $errorMessage . ').'; |
|
| 55 | + $messageParts[] = $jsonSchemaFile['jsonfilename'].' - '.$jsonSchemaFile['jsonfileurl'].'(last error: '.$errorMessage.').'; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | if ($errorStatus === true) { |
| 60 | - $message = 'JSON file (' . (string) $response->getUri() . ') does not validate against the following JSON Schema files: ' . implode(', ', $messageParts); |
|
| 60 | + $message = 'JSON file ('.(string) $response->getUri().') does not validate against the following JSON Schema files: '.implode(', ', $messageParts); |
|
| 61 | 61 | throw new ValidationFailedException($message); |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public function doValidation(Response $response) |
| 25 | 25 | { |
| 26 | 26 | $domDocument = new \DOMDocument(); |
| 27 | - @$domDocument->loadHTML((string)$response->getBody()); |
|
| 27 | + @$domDocument->loadHTML((string) $response->getBody()); |
|
| 28 | 28 | |
| 29 | 29 | $domXPath = new \DOMXPath($domDocument); |
| 30 | 30 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | try { |
| 38 | 38 | $selectorAsXPath = $converter->toXPath($selector['pattern']); |
| 39 | 39 | } catch (\Exception $e) { |
| 40 | - throw new ValidationFailedException('Invalid css selector (' . $selector['pattern'] . ').'); |
|
| 40 | + throw new ValidationFailedException('Invalid css selector ('.$selector['pattern'].').'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $count = $domXPath->query($selectorAsXPath)->length; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if ($error === true) { |
| 52 | 52 | $allNotFoundSelectors = implode('", "', $snotFoundSelectors); |
| 53 | 53 | |
| 54 | - throw new ValidationFailedException('CSS Selector "' . $allNotFoundSelectors . '" not found in DOM.'); |
|
| 54 | + throw new ValidationFailedException('CSS Selector "'.$allNotFoundSelectors.'" not found in DOM.'); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | } catch (ValidationFailedException $e) { |
| 97 | 97 | $result = new CheckResult(CheckResult::STATUS_FAILURE, $e->getMessage()); |
| 98 | 98 | } catch (\Exception $e) { |
| 99 | - $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occured: ' . $e->getMessage()); |
|
| 99 | + $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occured: '.$e->getMessage()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $result->setResponse($response); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | if ($url['url'] instanceof UriInterface) { |
| 93 | 93 | $urlObject = $url['url']; |
| 94 | - }else { |
|
| 94 | + } else { |
|
| 95 | 95 | $urlObject = new Uri($url['url']); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -112,20 +112,20 @@ discard block |
||
| 112 | 112 | /* @var \Ivory\HttpAdapter\HttpAdapterException $exception */ |
| 113 | 113 | |
| 114 | 114 | $mainUri = $request->getUri(); |
| 115 | - $this->redirects[(string)$mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl] = (string)$mainUri; |
|
| 115 | + $this->redirects[(string) $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl] = (string) $mainUri; |
|
| 116 | 116 | |
| 117 | - $this->urls[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
| 118 | - $this->urlStack[] = ['url' => $mainUri->getScheme() . '://' . $mainUri->getHost() . $corruptUrl, 'system' => $url['system']]; |
|
| 117 | + $this->urls[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
| 118 | + $this->urlStack[] = ['url' => $mainUri->getScheme().'://'.$mainUri->getHost().$corruptUrl, 'system' => $url['system']]; |
|
| 119 | 119 | |
| 120 | 120 | return $this->next(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // the error handling should be done withing the calling class |
| 124 | - echo "\n " . $exception->getMessage() . "\n"; |
|
| 124 | + echo "\n ".$exception->getMessage()."\n"; |
|
| 125 | 125 | |
| 126 | 126 | return $this->next(); |
| 127 | 127 | } else { |
| 128 | - $errorMessages .= $exception->getMessage() . "\n"; |
|
| 128 | + $errorMessages .= $exception->getMessage()."\n"; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | 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() |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | if ($url['url'] instanceof UriInterface) { |
| 93 | 93 | $urlObject = $url['url']; |
| 94 | - }else { |
|
| 94 | + } else { |
|
| 95 | 95 | $urlObject = new Uri($url['url']); |
| 96 | 96 | } |
| 97 | 97 | |