Completed
Push — master ( 2edd5e...e54f24 )
by Nils
02:14
created
SmokeResponseRetriever/Retriever/Crawler/Filter/LongUrlFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     public function isFiltered(UriInterface $currentUri, UriInterface $startUri)
21 21
     {
22
-        return strlen((string)$currentUri) > 255;
22
+        return strlen((string) $currentUri) > 255;
23 23
     }
24 24
 
25 25
     public function isResponseFiltered(ResponseInterface $response, UriInterface $startUri)
Please login to merge, or discard this patch.
src/Rules/Seo/RobotsDisallowAllRule.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use phm\HttpWebdriverClient\Http\Response\UriAwareResponse;
6 6
 use Psr\Http\Message\ResponseInterface;
7
-use whm\Smoke\Http\ClientAware;
8
-use whm\Smoke\Http\Response;
9 7
 use whm\Smoke\Rules\Rule;
10 8
 use whm\Smoke\Rules\ValidationFailedException;
11 9
 
Please login to merge, or discard this 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
     public function validate(ResponseInterface $response)
22 22
     {
23 23
         if ($response instanceof UriAwareResponse) {
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/Xml/XmlValidXsdRule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     protected function doValidation(ResponseInterface $response)
28 28
     {
29
-        $body = (string)$response->getBody();
29
+        $body = (string) $response->getBody();
30 30
 
31 31
         $dom = new \DOMDocument();
32 32
         @$dom->loadXML($body);
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
                 $error = true;
42 42
                 $lastError = libxml_get_last_error();
43 43
 
44
-                $messageParts[] = $xsdFile['xsdfilename'] . ' - ' . $xsdFile['xsdfileurl'] . ' (last error: ' . str_replace("\n", '', $lastError->message) . ').';
44
+                $messageParts[] = $xsdFile['xsdfilename'].' - '.$xsdFile['xsdfileurl'].' (last error: '.str_replace("\n", '', $lastError->message).').';
45 45
             }
46 46
         }
47 47
 
48 48
         if ($error === true) {
49
-            $message = 'XML file (' . (string)$response->getUri() . ')  does not validate against the following XSD files: ' . implode(', ', $messageParts);
49
+            $message = 'XML file ('.(string) $response->getUri().')  does not validate against the following XSD files: '.implode(', ', $messageParts);
50 50
             throw new ValidationFailedException($message);
51 51
         }
52 52
     }
Please login to merge, or discard this patch.
src/Scanner/Scanner.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
                     $result = new CheckResult(CheckResult::STATUS_SUCCESS, 'Check successful.');
104 104
                 }
105 105
             } catch (\Exception $e) {
106
-                $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occurred: ' . $e->getMessage());
106
+                $result = new CheckResult(CheckResult::STATUS_FAILURE, 'An error occurred: '.$e->getMessage());
107 107
                 $this->eventDispatcher->simpleNotify('Scanner.CheckResponse.Rule.Error', array('checkResult' => $result, 'ruleName' => $name, 'exception' => $e));
108 108
             }
109 109
 
Please login to merge, or discard this patch.
src/Http/GuzzleClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function init($nocache = true, $clientTimeout = 20000)
23 23
     {
24
-        $timeoutInSeconds = (int)($clientTimeout / 1000);
24
+        $timeoutInSeconds = (int) ($clientTimeout / 1000);
25 25
 
26 26
         if ($nocache) {
27 27
             $this->guzzleClient = new phmGuzzleClient(null, $timeoutInSeconds);
Please login to merge, or discard this patch.
src/Rules/CheckResult.php 1 patch
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,6 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param $status
43 43
      * @param $value
44 44
      * @param $message
45
+     * @param string $url
45 46
      */
46 47
     public function __construct($status, $message = '', $value = null, $url = null)
47 48
     {
@@ -73,7 +74,7 @@  discard block
 block discarded – undo
73 74
     }
74 75
 
75 76
     /**
76
-     * @param Attribute $attributes
77
+     * @param Attribute $attribute
77 78
      */
78 79
     public function addAttribute(Attribute $attribute)
79 80
     {
@@ -136,7 +137,7 @@  discard block
 block discarded – undo
136 137
     }
137 138
 
138 139
     /**
139
-     * @param string $identifier
140
+     * @param string $identifierRule
140 141
      */
141 142
     public function setIdentifierRule($identifierRule)
142 143
     {
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
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/Rules/Html/InvalidUrlsRule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,22 +18,22 @@
 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 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
 }
Please login to merge, or discard this patch.