@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | private function getSchema($isIndex) |
35 | 35 | { |
36 | 36 | if ($isIndex) { |
37 | - return __DIR__ . '/' . self::INDEX; |
|
37 | + return __DIR__.'/'.self::INDEX; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if ($this->strictMode) { |
41 | - return __DIR__ . '/' . self::SCHEMA; |
|
41 | + return __DIR__.'/'.self::SCHEMA; |
|
42 | 42 | } else { |
43 | - return __DIR__ . '/' . self::NON_STRICT_SCHEMA; |
|
43 | + return __DIR__.'/'.self::NON_STRICT_SCHEMA; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | |
66 | 66 | if (!$valid) { |
67 | 67 | $lastError = libxml_get_last_error(); |
68 | - $message = 'The given sitemap file (' . $filename . ') did not validate against the sitemap schema (last error: ' . str_replace("\n", '', $lastError->message) . ').'; |
|
68 | + $message = 'The given sitemap file ('.$filename.') did not validate against the sitemap schema (last error: '.str_replace("\n", '', $lastError->message).').'; |
|
69 | 69 | return new CheckResult(CheckResult::STATUS_FAILURE, $message); |
70 | 70 | } else { |
71 | - $message = 'The given sitemap file (' . $filename . ') is valid.'; |
|
71 | + $message = 'The given sitemap file ('.$filename.') is valid.'; |
|
72 | 72 | return new CheckResult(CheckResult::STATUS_SUCCESS, $message); |
73 | 73 | |
74 | 74 | } |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | protected function doValidation(ResponseInterface $response) |
82 | 82 | { |
83 | 83 | if ($response instanceof DomAwareResponse) { |
84 | - $body = (string)$response->getHtmlBody(); |
|
84 | + $body = (string) $response->getHtmlBody(); |
|
85 | 85 | } else { |
86 | - $body = (string)$response->getBody(); |
|
86 | + $body = (string) $response->getBody(); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | if ($response->hasHeader('content-type')) { |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | |
96 | 96 | // sitemapindex or urlset |
97 | 97 | if (preg_match('/<sitemapindex/', $body)) { |
98 | - return $this->validateBody($body, (string)$response->getUri(), true); |
|
98 | + return $this->validateBody($body, (string) $response->getUri(), true); |
|
99 | 99 | } elseif (preg_match('/<urlset/', $body)) { |
100 | - return $this->validateBody($body, (string)$response->getUri(), false); |
|
100 | + return $this->validateBody($body, (string) $response->getUri(), false); |
|
101 | 101 | } else { |
102 | 102 | throw new ValidationFailedException('The given document is not a valid sitemap. Nether sitemapindex nor urlset element was found. '); |
103 | 103 | } |
@@ -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 init() |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ))); |
45 | 45 | |
46 | 46 | if (property_exists($result, 'error')) { |
47 | - $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "' . $result->error->message . '"'); |
|
47 | + $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "'.$result->error->message.'"'); |
|
48 | 48 | $checkResult->addAttribute(new Attribute('Google response', json_encode($result), true)); |
49 | 49 | return $checkResult; |
50 | 50 | } |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | $passResult = $result->ruleGroups->USABILITY; |
53 | 53 | |
54 | 54 | if (!$passResult->pass) { |
55 | - $result = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
55 | + $result = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
56 | 56 | |
57 | 57 | } else { |
58 | - $result = new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
58 | + $result = new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $result->addAttribute(new Attribute('google_result', json_encode($result), true)); |
@@ -18,22 +18,22 @@ |
||
18 | 18 | */ |
19 | 19 | protected function doValidation(ResponseInterface $response) |
20 | 20 | { |
21 | - $document = new Document((string)$response->getBody(), false); |
|
21 | + $document = new Document((string) $response->getBody(), false); |
|
22 | 22 | $urls = $document->getDependencies($response->getUri()); |
23 | 23 | $invalidUrls = array(); |
24 | 24 | |
25 | 25 | foreach ($urls as $url) { |
26 | 26 | if (function_exists('idn_to_ascii')) { |
27 | - $idnUrl = $url->getScheme() . '://' . idn_to_ascii($url->getHost(), 0, INTL_IDNA_VARIANT_UTS46) . $url->getPath(); |
|
27 | + $idnUrl = $url->getScheme().'://'.idn_to_ascii($url->getHost(), 0, INTL_IDNA_VARIANT_UTS46).$url->getPath(); |
|
28 | 28 | } else { |
29 | - $idnUrl = $url->getScheme() . '://' . $url->getHost() . $url->getPath(); |
|
29 | + $idnUrl = $url->getScheme().'://'.$url->getHost().$url->getPath(); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if (!filter_var($idnUrl, FILTER_VALIDATE_URL)) { |
33 | - $invalidUrls[] = (string)$url; |
|
33 | + $invalidUrls[] = (string) $url; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - $this->assert(count($invalidUrls) === 0, 'Invalid urls found (' . implode(', ', $invalidUrls) . ').'); |
|
37 | + $this->assert(count($invalidUrls) === 0, 'Invalid urls found ('.implode(', ', $invalidUrls).').'); |
|
38 | 38 | } |
39 | 39 | } |