@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | |
32 | 32 | // @todo this could be part of an abstract class |
33 | 33 | if ($this->useDom) { |
34 | - $content = (string)$response->getBody(); |
|
34 | + $content = (string) $response->getBody(); |
|
35 | 35 | } else { |
36 | 36 | if ($response instanceof DomAwareResponse) { |
37 | 37 | $content = $response->getHtmlBody(); |
38 | 38 | } else { |
39 | - $content = (string)$response->getBody(); |
|
39 | + $content = (string) $response->getBody(); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | $count = $domXPath->query($xpath['pattern'])->length; |
49 | 49 | |
50 | 50 | if ($xpath['relation'] === 'equals') { |
51 | - $result = $count === (int)$xpath['value']; |
|
52 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were exact ' . $xpath['value'] . ' occurencies.'; |
|
51 | + $result = $count === (int) $xpath['value']; |
|
52 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were exact '.$xpath['value'].' occurencies.'; |
|
53 | 53 | } elseif ($xpath['relation'] === 'less than') { |
54 | - $result = $count < (int)$xpath['value']; |
|
55 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were less than ' . $xpath['value'] . '.'; |
|
54 | + $result = $count < (int) $xpath['value']; |
|
55 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were less than '.$xpath['value'].'.'; |
|
56 | 56 | } elseif ($xpath['relation'] === 'greater than') { |
57 | - $result = $count > (int)$xpath['value']; |
|
58 | - $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were more than ' . $xpath['value'] . '.'; |
|
57 | + $result = $count > (int) $xpath['value']; |
|
58 | + $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were more than '.$xpath['value'].'.'; |
|
59 | 59 | } else { |
60 | - throw new \RuntimeException('Relation not defined. Given "' . $xpath['relation'] . '" expected [equals, greater than, less than]'); |
|
60 | + throw new \RuntimeException('Relation not defined. Given "'.$xpath['relation'].'" expected [equals, greater than, less than]'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $this->assert($result, $message); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | private function getEndpoint(UriInterface $uri) |
16 | 16 | { |
17 | - return str_replace('#url#', urlencode((string)$uri), self::ENDPOINT); |
|
17 | + return str_replace('#url#', urlencode((string) $uri), self::ENDPOINT); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function validate(ResponseInterface $response) |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | ))); |
34 | 34 | |
35 | 35 | if (property_exists($result, 'error')) { |
36 | - $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "' . $result->error->message . '"'); |
|
36 | + $checkResult = new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Error "'.$result->error->message.'"'); |
|
37 | 37 | $checkResult->addAttribute(new Attribute('Google response', json_encode($result), true)); |
38 | 38 | return $checkResult; |
39 | 39 | } |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $passResult = $result->ruleGroups->USABILITY; |
42 | 42 | |
43 | 43 | if (!$passResult->pass) { |
44 | - return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
44 | + return new CheckResult(CheckResult::STATUS_FAILURE, 'Google mobile friendly test was not passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
45 | 45 | } |
46 | 46 | |
47 | - return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score ' . $passResult->score . '/100.', (int)$passResult->score); |
|
47 | + return new CheckResult(CheckResult::STATUS_SUCCESS, 'Google mobile friendly test passed. Score '.$passResult->score.'/100.', (int) $passResult->score); |
|
48 | 48 | } |
49 | 49 | } |
@@ -29,14 +29,14 @@ |
||
29 | 29 | if ($response->getDuration() > $this->maxDuration) { |
30 | 30 | return new CheckResult( |
31 | 31 | CheckResult::STATUS_FAILURE, |
32 | - 'The http request took ' . (int)$response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).', |
|
33 | - (int)$response->getDuration()); |
|
32 | + 'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).', |
|
33 | + (int) $response->getDuration()); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | return new CheckResult( |
37 | 37 | CheckResult::STATUS_SUCCESS, |
38 | - 'The http request took ' . (int)$response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).', |
|
39 | - (int)$response->getDuration()); |
|
38 | + 'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).', |
|
39 | + (int) $response->getDuration()); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -27,6 +27,9 @@ discard block |
||
27 | 27 | $this->strictMode = $strictMode; |
28 | 28 | } |
29 | 29 | |
30 | + /** |
|
31 | + * @param boolean $isIndex |
|
32 | + */ |
|
30 | 33 | private function getSchema($isIndex) |
31 | 34 | { |
32 | 35 | if ($isIndex) { |
@@ -41,8 +44,8 @@ discard block |
||
41 | 44 | } |
42 | 45 | |
43 | 46 | /** |
44 | - * @param $body |
|
45 | - * @param $filename |
|
47 | + * @param string $body |
|
48 | + * @param string $filename |
|
46 | 49 | * @param bool $isIndex |
47 | 50 | * @throws ValidationFailedException |
48 | 51 | */ |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | private function getSchema($isIndex) |
31 | 31 | { |
32 | 32 | if ($isIndex) { |
33 | - return __DIR__ . '/' . self::INDEX; |
|
33 | + return __DIR__.'/'.self::INDEX; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | if ($this->strictMode) { |
37 | - return __DIR__ . '/' . self::SCHEMA; |
|
37 | + return __DIR__.'/'.self::SCHEMA; |
|
38 | 38 | } else { |
39 | - return __DIR__ . '/' . self::NON_STRICT_SCHEMA; |
|
39 | + return __DIR__.'/'.self::NON_STRICT_SCHEMA; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | if (!$valid) { |
57 | 57 | $lastError = libxml_get_last_error(); |
58 | 58 | throw new ValidationFailedException( |
59 | - 'The given sitemap file (' . $filename . ') did not validate against the sitemap schema (last error: ' . str_replace("\n", '', $lastError->message) . ').'); |
|
59 | + 'The given sitemap file ('.$filename.') did not validate against the sitemap schema (last error: '.str_replace("\n", '', $lastError->message).').'); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | protected function doValidation(ResponseInterface $response) |
68 | 68 | { |
69 | 69 | if ($response instanceof DomAwareResponse) { |
70 | - $body = (string)$response->getHtmlBody(); |
|
70 | + $body = (string) $response->getHtmlBody(); |
|
71 | 71 | } else { |
72 | - $body = (string)$response->getBody(); |
|
72 | + $body = (string) $response->getBody(); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // sitemapindex or urlset |
76 | 76 | if (preg_match('/<sitemapindex/', $body)) { |
77 | - $this->validateBody($body, (string)$response->getUri()); |
|
77 | + $this->validateBody($body, (string) $response->getUri()); |
|
78 | 78 | } elseif (preg_match('/<urlset/', $body)) { |
79 | - $this->validateBody($body, (string)$response->getUri(), false); |
|
79 | + $this->validateBody($body, (string) $response->getUri(), false); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | public function doValidation(ResponseInterface $response) |
25 | 25 | { |
26 | 26 | if ($response instanceof DomAwareResponse) { |
27 | - $body = (string)$response->getHtmlBody(); |
|
27 | + $body = (string) $response->getHtmlBody(); |
|
28 | 28 | } else { |
29 | - $body = (string)$response->getBody(); |
|
29 | + $body = (string) $response->getBody(); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if ($body == "") { |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | $lastError = libxml_get_last_error(); |
46 | 46 | |
47 | 47 | if ($lastError) { |
48 | - throw new ValidationFailedException('The xml file ' . $response->getUri() . ' is not well formed (last error: ' . |
|
49 | - str_replace("\n", '', $lastError->message) . ').'); |
|
48 | + throw new ValidationFailedException('The xml file '.$response->getUri().' is not well formed (last error: '. |
|
49 | + str_replace("\n", '', $lastError->message).').'); |
|
50 | 50 | } else { |
51 | 51 | return new CheckResult(CheckResult::STATUS_FAILURE, 'Unknown error occured.'); |
52 | 52 | } |
@@ -38,6 +38,7 @@ discard block |
||
38 | 38 | * @param $status |
39 | 39 | * @param $value |
40 | 40 | * @param $message |
41 | + * @param string $url |
|
41 | 42 | */ |
42 | 43 | public function __construct($status, $message = '', $value = null, $url = null) |
43 | 44 | { |
@@ -56,7 +57,7 @@ discard block |
||
56 | 57 | } |
57 | 58 | |
58 | 59 | /** |
59 | - * @param array $attributes |
|
60 | + * @param array $attribute |
|
60 | 61 | */ |
61 | 62 | public function addAttribute(Attribute $attribute) |
62 | 63 | { |
@@ -109,7 +110,7 @@ discard block |
||
109 | 110 | } |
110 | 111 | |
111 | 112 | /** |
112 | - * @param string $identifier |
|
113 | + * @param string $identifierRule |
|
113 | 114 | */ |
114 | 115 | public function setIdentifierRule($identifierRule) |
115 | 116 | { |