@@ -103,7 +103,7 @@ |
||
| 103 | 103 | $result = new CheckResult(CheckResult::STATUS_SUCCESS, 'Check successful.'); |
| 104 | 104 | } |
| 105 | 105 | } catch (\Exception $e) { |
| 106 | - $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occurred: ' . $e->getMessage()); |
|
| 106 | + $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occurred: '.$e->getMessage()); |
|
| 107 | 107 | $this->eventDispatcher->simpleNotify('Scanner.CheckResponse.Rule.Error', array('checkResult' => $result, 'ruleName' => $name, 'exception' => $e)); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | private function getEndpoint(UriInterface $uri) |
| 17 | 17 | { |
| 18 | - return str_replace('#url#', urlencode((string)$uri), self::ENDPOINT); |
|
| 18 | + return str_replace('#url#', urlencode((string) $uri), self::ENDPOINT); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function validate(ResponseInterface $response) |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ))); |
| 39 | 39 | |
| 40 | 40 | if (property_exists($result, 'error')) { |
| 41 | - $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "' . $result->error->message . '"'); |
|
| 41 | + $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "'.$result->error->message.'"'); |
|
| 42 | 42 | $checkResult->addAttribute(new Attribute('Google response', json_encode($result), true)); |
| 43 | 43 | return $checkResult; |
| 44 | 44 | } |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | $passResult = $result->ruleGroups->USABILITY; |
| 47 | 47 | |
| 48 | 48 | if (!$passResult->pass) { |
| 49 | - $result = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
| 49 | + $result = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
| 50 | 50 | |
| 51 | 51 | } else { |
| 52 | - $result = new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
| 52 | + $result = new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $result->addAttribute(new Attribute('google_result', json_encode($result), true)); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function init($nocache = false, $clientTimeout = 20000) |
| 23 | 23 | { |
| 24 | - $timeoutInSeconds = (int)($clientTimeout / 1000); |
|
| 24 | + $timeoutInSeconds = (int) ($clientTimeout / 1000); |
|
| 25 | 25 | |
| 26 | 26 | if ($nocache) { |
| 27 | 27 | $this->guzzleClient = new phmGuzzleClient(null, $timeoutInSeconds); |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | private function getSchema($isIndex) |
| 37 | 37 | { |
| 38 | 38 | if ($isIndex) { |
| 39 | - return __DIR__ . '/' . self::INDEX; |
|
| 39 | + return __DIR__.'/'.self::INDEX; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if ($this->strictMode) { |
| 43 | - return __DIR__ . '/' . self::SCHEMA; |
|
| 43 | + return __DIR__.'/'.self::SCHEMA; |
|
| 44 | 44 | } else { |
| 45 | - return __DIR__ . '/' . self::NON_STRICT_SCHEMA; |
|
| 45 | + return __DIR__.'/'.self::NON_STRICT_SCHEMA; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | if (!$valid) { |
| 63 | 63 | $lastError = libxml_get_last_error(); |
| 64 | - $message = 'The given sitemap file (' . $filename . ') did not validate against the sitemap schema (last error: ' . str_replace("\n", '', $lastError->message) . ').'; |
|
| 64 | + $message = 'The given sitemap file ('.$filename.') did not validate against the sitemap schema (last error: '.str_replace("\n", '', $lastError->message).').'; |
|
| 65 | 65 | return new CheckResult(CheckResult::STATUS_FAILURE, $message); |
| 66 | 66 | } else { |
| 67 | - $message = 'The given sitemap file (' . $filename . ') is valid.'; |
|
| 67 | + $message = 'The given sitemap file ('.$filename.') is valid.'; |
|
| 68 | 68 | return new CheckResult(CheckResult::STATUS_FAILURE, $message); |
| 69 | 69 | |
| 70 | 70 | } |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | $contentType = $response->getHeader('content-type'); |
| 80 | 80 | |
| 81 | 81 | if ($response instanceof DomAwareResponse) { |
| 82 | - $body = (string)$response->getHtmlBody(); |
|
| 82 | + $body = (string) $response->getHtmlBody(); |
|
| 83 | 83 | } else { |
| 84 | - $body = (string)$response->getBody(); |
|
| 84 | + $body = (string) $response->getBody(); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (is_array($contentType) && in_array(strtolower($contentType[0]), $this->gzipContentTypes)) { |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | // sitemapindex or urlset |
| 92 | 92 | if (preg_match('/<sitemapindex/', $body)) { |
| 93 | - return $this->validateBody($body, (string)$response->getUri(), true); |
|
| 93 | + return $this->validateBody($body, (string) $response->getUri(), true); |
|
| 94 | 94 | } elseif (preg_match('/<urlset/', $body)) { |
| 95 | - return $this->validateBody($body, (string)$response->getUri(), false); |
|
| 95 | + return $this->validateBody($body, (string) $response->getUri(), false); |
|
| 96 | 96 | } else { |
| 97 | 97 | throw new ValidationFailedException('The given document is not a valid sitemap. Nether sitemapindex nor urlset element was found. '); |
| 98 | 98 | } |