@@ -35,13 +35,13 @@ |
||
| 35 | 35 | var_dump($result); |
| 36 | 36 | |
| 37 | 37 | if ($result->error) { |
| 38 | - throw new ValidationFailedException('Google mobile friendly test was not passed. Error "' . $result->error->message . '"'); |
|
| 38 | + throw new ValidationFailedException('Google mobile friendly test was not passed. Error "'.$result->error->message.'"'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $passResult = $result->ruleGroups->USABILITY; |
| 42 | 42 | |
| 43 | 43 | if (!$passResult->pass) { |
| 44 | - throw new ValidationFailedException('Google mobile friendly test was not passed. Score ' . $passResult->score . '/100.'); |
|
| 44 | + throw new ValidationFailedException('Google mobile friendly test was not passed. Score '.$passResult->score.'/100.'); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -49,6 +49,9 @@ |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param string $content |
|
| 54 | + */ |
|
| 52 | 55 | private function normalizeContent($content) |
| 53 | 56 | { |
| 54 | 57 | $normalizedContent = strtolower($content); |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function validate(Response $response) |
| 22 | 22 | { |
| 23 | - $url = $response->getUri()->getScheme() . '://' . $response->getUri()->getHost(); |
|
| 23 | + $url = $response->getUri()->getScheme().'://'.$response->getUri()->getHost(); |
|
| 24 | 24 | |
| 25 | 25 | if (substr_count($url, '/') === 2) { |
| 26 | - $filename = $robotsUrl = $url . '/robots.txt'; |
|
| 26 | + $filename = $robotsUrl = $url.'/robots.txt'; |
|
| 27 | 27 | } elseif (substr_count($url, '/') === 3) { |
| 28 | - $filename = $robotsUrl = $url . 'robots.txt'; |
|
| 28 | + $filename = $robotsUrl = $url.'robots.txt'; |
|
| 29 | 29 | } else { |
| 30 | 30 | return; |
| 31 | 31 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $normalizedContent = $this->normalizeContent($content); |
| 42 | 42 | |
| 43 | - if (strpos($normalizedContent, 'user-agent:* disallow:/' . PHP_EOL) !== false) { |
|
| 43 | + if (strpos($normalizedContent, 'user-agent:* disallow:/'.PHP_EOL) !== false) { |
|
| 44 | 44 | throw new ValidationFailedException('The robots.txt contains disallow all (Disallow: /)'); |
| 45 | 45 | } |
| 46 | 46 | |