Completed
Push — master ( f92a0a...857c7b )
by Nils
02:28
created
src/Rules/Http/Header/HttpStatusRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     public function validate(ResponseInterface $response)
27 27
     {
28 28
         if ($response->getStatusCode() !== $this->expectedStatus) {
29
-            throw new ValidationFailedException('Status code ' . $response->getStatusCode() . ' found, ' . $this->expectedStatus . ' expected.');
29
+            throw new ValidationFailedException('Status code '.$response->getStatusCode().' found, '.$this->expectedStatus.' expected.');
30 30
         }
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
src/Rules/Http/DurationRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@
 block discarded – undo
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.',
39
-                (int)$response->getDuration());
38
+                'The http request took '.(int) $response->getDuration().' milliseconds.',
39
+                (int) $response->getDuration());
40 40
         }
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
src/Rules/Html/RegExNotExistsRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
     protected function doValidation(ResponseInterface $response)
26 26
     {
27 27
         foreach ($this->regExs as $regEx) {
28
-            $this->assert(preg_match('^' . $regEx . '^', (string)$response->getBody()) === 0,
29
-                'The given regular expression (' . $regEx . ') was found in this document.');
28
+            $this->assert(preg_match('^'.$regEx.'^', (string) $response->getBody()) === 0,
29
+                'The given regular expression ('.$regEx.') was found in this document.');
30 30
         }
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
src/Rules/Html/RegExExistsRule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
         foreach ($this->regExs as $regEx) {
31 31
             if ($regEx['isRegEx']) {
32
-                if (preg_match('^' . $regEx['pattern'] . '^', (string)$response->getBody()) === 0) {
33
-                    $errors[] = 'Regular expression: ' . $regEx['pattern'];
32
+                if (preg_match('^'.$regEx['pattern'].'^', (string) $response->getBody()) === 0) {
33
+                    $errors[] = 'Regular expression: '.$regEx['pattern'];
34 34
                 }
35 35
             } else {
36
-                if (preg_match('^' . preg_quote($regEx['pattern']) . '^', (string)$response->getBody()) === 0) {
37
-                    $errors[] = 'Text: ' . $regEx['pattern'];
36
+                if (preg_match('^'.preg_quote($regEx['pattern']).'^', (string) $response->getBody()) === 0) {
37
+                    $errors[] = 'Text: '.$regEx['pattern'];
38 38
                 }
39 39
             }
40 40
         }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             $errorString = 'The following text elements were not found: <ul>';
44 44
 
45 45
             foreach ($errors as $error) {
46
-                $errorString .= '<li>' . $error . '</li>';
46
+                $errorString .= '<li>'.$error.'</li>';
47 47
             }
48 48
 
49 49
             $errorString .= '</ul>';
Please login to merge, or discard this patch.
src/Rules/Html/CountRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 
27 27
     protected function doValidation(ResponseInterface $response)
28 28
     {
29
-        $document = new Document((string)$response->getBody());
29
+        $document = new Document((string) $response->getBody());
30 30
         $files = $this->getFilesToCount($document, $response);
31 31
 
32 32
         $this->assert(count($files) <= $this->maxCount, sprintf($this->errorMessage, count($files)));
Please login to merge, or discard this patch.
src/Rules/Html/XPathExistsRule.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function doValidation(ResponseInterface $response)
23 23
     {
24 24
         $domDocument = new \DOMDocument();
25
-        @$domDocument->loadHTML((string)$response->getBody());
25
+        @$domDocument->loadHTML((string) $response->getBody());
26 26
 
27 27
         $domXPath = new \DOMXPath($domDocument);
28 28
 
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
             $count = $domXPath->query($xpath['pattern'])->length;
31 31
 
32 32
             if ($xpath['relation'] === 'equals') {
33
-                $result = $count === (int)$xpath['value'];
34
-                $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were exact ' . $xpath['value'] . ' occurencies.';
33
+                $result = $count === (int) $xpath['value'];
34
+                $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were exact '.$xpath['value'].' occurencies.';
35 35
             } elseif ($xpath['relation'] === 'less than') {
36
-                $result = $count < (int)$xpath['value'];
37
-                $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were less than ' . $xpath['value'] . '.';
36
+                $result = $count < (int) $xpath['value'];
37
+                $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were less than '.$xpath['value'].'.';
38 38
             } elseif ($xpath['relation'] === 'greater than') {
39
-                $result = $count > (int)$xpath['value'];
40
-                $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were more than ' . $xpath['value'] . '.';
39
+                $result = $count > (int) $xpath['value'];
40
+                $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were more than '.$xpath['value'].'.';
41 41
             } else {
42
-                throw new \RuntimeException('Relation not defined. Given "' . $xpath['relation'] . '" expected [equals, greater than, less than]');
42
+                throw new \RuntimeException('Relation not defined. Given "'.$xpath['relation'].'" expected [equals, greater than, less than]');
43 43
             }
44 44
 
45 45
             $this->assert($result, $message);
Please login to merge, or discard this patch.
src/Rules/Html/CssSelectorExistsRule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function doValidation(ResponseInterface $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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Rules/Seo/RobotsDisallowAllRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function validate(ResponseInterface $response)
23 23
     {
24
-        $url = $response->getUri()->getScheme() . '://' . $response->getUri()->getHost();
24
+        $url = $response->getUri()->getScheme().'://'.$response->getUri()->getHost();
25 25
 
26 26
         if (substr_count($url, '/') === 2) {
27
-            $filename = $robotsUrl = $url . '/robots.txt';
27
+            $filename = $robotsUrl = $url.'/robots.txt';
28 28
         } elseif (substr_count($url, '/') === 3) {
29
-            $filename = $robotsUrl = $url . 'robots.txt';
29
+            $filename = $robotsUrl = $url.'robots.txt';
30 30
         } else {
31 31
             return;
32 32
         }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         $normalizedContent = $this->normalizeContent($content);
41 41
 
42
-        if (strpos($normalizedContent, 'user-agent:* disallow:/' . PHP_EOL) !== false) {
42
+        if (strpos($normalizedContent, 'user-agent:* disallow:/'.PHP_EOL) !== false) {
43 43
             throw new ValidationFailedException('The robots.txt contains disallow all (Disallow: /)');
44 44
         }
45 45
 
Please login to merge, or discard this patch.
src/Rules/Seo/GoogleMobileFriendlyRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     private function getEndpoint(Uri $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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.