Completed
Push — master ( 9e95a1...6bb926 )
by Nils
06:58
created
src/Rules/Html/InvalidUrlsRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@
 block discarded – undo
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
-            $idnUrl = $url->getScheme() . '://' . idn_to_ascii($url->getHost()) . $url->getPath();
26
+            $idnUrl = $url->getScheme().'://'.idn_to_ascii($url->getHost()).$url->getPath();
27 27
 
28 28
             if (!filter_var($idnUrl, FILTER_VALIDATE_URL)) {
29
-                $invalidUrls[] = (string)$url;
29
+                $invalidUrls[] = (string) $url;
30 30
             }
31 31
         }
32 32
 
33
-        $this->assert(count($invalidUrls) === 0, 'Invalid urls found (' . implode(', ', $invalidUrls) . ').');
33
+        $this->assert(count($invalidUrls) === 0, 'Invalid urls found ('.implode(', ', $invalidUrls).').');
34 34
     }
35 35
 }
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
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function doValidation(ResponseInterface $response)
25 25
     {
26
-        $content = (string)$response->getBody();
26
+        $content = (string) $response->getBody();
27 27
 
28 28
         $domDocument = new \DOMDocument();
29 29
         @$domDocument->loadHTML($content);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
             try {
41 41
                 $selectorAsXPath = $converter->toXPath($selector['pattern']);
42 42
             } catch (\Exception $e) {
43
-                throw new ValidationFailedException('Invalid css selector (' . $selector['pattern'] . ').');
43
+                throw new ValidationFailedException('Invalid css selector ('.$selector['pattern'].').');
44 44
             }
45 45
 
46 46
             $count = $domXPath->query($selectorAsXPath)->length;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         if ($error === true) {
55 55
             $allNotFoundSelectors = implode('", "', $snotFoundSelectors);
56 56
 
57
-            throw new ValidationFailedException('CSS Selector "' . $allNotFoundSelectors . '" not found in DOM.');
57
+            throw new ValidationFailedException('CSS Selector "'.$allNotFoundSelectors.'" not found in DOM.');
58 58
         }
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
src/Rules/Http/Header/GZipRule.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
                 && strpos($response->getContentType(), 'pdf') === false
27 27
                 && strpos($response->getContentType(), 'postscript') === false
28 28
                 && strpos($response->getContentType(), 'zip') === false
29
-                && strlen((string)$response->getBody()) >= $this->minFileSize
29
+                && strlen((string) $response->getBody()) >= $this->minFileSize
30 30
             ) {
31 31
                 if (!$response->hasHeader('Content-Encoding') || $response->getHeader('Content-Encoding')[0] !== 'gzip') {
32 32
                     throw new ValidationFailedException('gzip compression not active');
Please login to merge, or discard this patch.
src/Rules/Html/BrokenLinkRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@
 block discarded – undo
49 49
 
50 50
             if (count($errorList) > 0) {
51 51
                 $count = count($errorList);
52
-                $msg = 'Found ' . $count . ' broken link(s). <ul>';
52
+                $msg = 'Found '.$count.' broken link(s). <ul>';
53 53
                 foreach ($errorList as $error) {
54
-                    $msg .= '<li>' . $error['name'] . ' (http status: ' . $error['http_status'] . ')</li>';
54
+                    $msg .= '<li>'.$error['name'].' (http status: '.$error['http_status'].')</li>';
55 55
                 }
56 56
                 $msg .= '</ul>';
57 57
                 return new CheckResult(CheckResult::STATUS_FAILURE, $msg, $count);
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/CliReporter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
         if ($response instanceof RequestAwareResponse) {
38 38
             $request = $response->getRequest();
39 39
             if ($request instanceof DeviceAwareRequest) {
40
-                return ' (Device: ' . $request->getDevice()->getName() . ')';
40
+                return ' (Device: '.$request->getDevice()->getName().')';
41 41
             } else if ($request instanceof ViewportAwareRequest) {
42 42
                 $viewport = $request->getViewport();
43
-                return ' (Viewport: width: ' . $viewport->getWidth() . ', height: ' . $viewport->getHeight() . ')';
43
+                return ' (Viewport: width: '.$viewport->getWidth().', height: '.$viewport->getHeight().')';
44 44
             }
45 45
         }
46 46
 
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 
50 50
     protected function renderFailure(CheckResult $result)
51 51
     {
52
-        $this->output->writeln('   <error> ' . (string)$result->getResponse()->getUri() . $this->getRequestString($result->getResponse()) . ' </error> coming from ' . (string)$this->retriever->getComingFrom($result->getResponse()->getUri()));
53
-        $this->output->writeln('    - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']');
52
+        $this->output->writeln('   <error> '.(string) $result->getResponse()->getUri().$this->getRequestString($result->getResponse()).' </error> coming from '.(string) $this->retriever->getComingFrom($result->getResponse()->getUri()));
53
+        $this->output->writeln('    - '.$result->getMessage().' [rule: '.$result->getRuleName().']');
54 54
         $this->output->writeln('');
55 55
     }
56 56
 
57 57
     protected function renderSuccess(CheckResult $result)
58 58
     {
59
-        $this->output->writeln('   <info> ' . (string)$result->getResponse()->getUri() . $this->getRequestString($result->getResponse()) . ' </info> all tests passed');
59
+        $this->output->writeln('   <info> '.(string) $result->getResponse()->getUri().$this->getRequestString($result->getResponse()).' </info> all tests passed');
60 60
     }
61 61
 
62 62
     protected function renderSkipped(CheckResult $result)
63 63
     {
64
-        $this->output->writeln('   <comment> ' . (string)$result->getResponse()->getUri() . $this->getRequestString($result->getResponse()) . ' </comment>test skipped');
65
-        $this->output->writeln('    - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']');
64
+        $this->output->writeln('   <comment> '.(string) $result->getResponse()->getUri().$this->getRequestString($result->getResponse()).' </comment>test skipped');
65
+        $this->output->writeln('    - '.$result->getMessage().' [rule: '.$result->getRuleName().']');
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
src/Rules/Html/XPathExistsRule.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
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(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
 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.