Completed
Push — master ( 6161b2...9ad1a6 )
by Nils
05:17 queued 02:48
created
src/Rules/CheckResult.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      * Result constructor.
27 27
      *
28 28
      * @param $status
29
-     * @param $value
29
+     * @param integer $value
30 30
      * @param $message
31 31
      */
32 32
     public function __construct($status, $message = '', $value = null)
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     /**
48
-     * @param array $attributes
48
+     * @param array $attribute
49 49
      */
50 50
     public function addAttribute(Attribute $attribute)
51 51
     {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     }
70 70
 
71 71
     /**
72
-     * @return mixed
72
+     * @return string
73 73
      */
74 74
     public function getMessage()
75 75
     {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     }
86 86
 
87 87
     /**
88
-     * @param Response $response
88
+     * @param ResponseInterface $response
89 89
      */
90 90
     public function setResponse(ResponseInterface $response)
91 91
     {
Please login to merge, or discard this patch.
src/Rules/Html/CssFileCountRule.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6 6
 use whm\Html\Document;
7
-use whm\Smoke\Http\Response;
8 7
 
9 8
 /**
10 9
  * This rules counts the css files that are included in a document. If the number is higher
Please login to merge, or discard this patch.
src/Rules/Html/JsFileCountRule.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6 6
 use whm\Html\Document;
7
-use whm\Smoke\Http\Response;
8 7
 
9 8
 /**
10 9
  * This rules counts the js files that are included in a document. If the number is higher
Please login to merge, or discard this patch.
src/Rules/Image/FavIconRule.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace whm\Smoke\Rules\Image;
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6
-use whm\Smoke\Http\Response;
7 6
 use whm\Smoke\Rules\StandardRule;
8 7
 
9 8
 /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@
 block discarded – undo
30 30
             return;
31 31
         }
32 32
 
33
-        $imageHash = md5((string)$response->getBody());
33
+        $imageHash = md5((string) $response->getBody());
34 34
 
35
-        $this->assert(!array_key_exists($imageHash, $this->favicons), 'Seems like you use the standard favicon of your framework (' . $this->favicons[$imageHash] . ').');
35
+        $this->assert(!array_key_exists($imageHash, $this->favicons), 'Seems like you use the standard favicon of your framework ('.$this->favicons[$imageHash].').');
36 36
     }
37 37
 }
Please login to merge, or discard this patch.
src/Rules/Json/JsonSchema/JsonSchemaRule.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use JsonSchema\Validator;
6 6
 use Psr\Http\Message\ResponseInterface;
7
-use whm\Smoke\Http\Response;
8 7
 use whm\Smoke\Rules\StandardRule;
9 8
 use whm\Smoke\Rules\ValidationFailedException;
10 9
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
     protected function doValidation(ResponseInterface $response)
35 35
     {
36
-        $data = json_decode((string)$response->getBody());
36
+        $data = json_decode((string) $response->getBody());
37 37
         if ($data === null) {
38
-            throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "').");
38
+            throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."').");
39 39
         } else {
40 40
             $errorStatus = false;
41 41
             $messageParts = array();
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
                     $errorStatus = true;
52 52
                     $errorMessage = '';
53 53
                     foreach ($validator->getErrors() as $error) {
54
-                        $errorMessage = $errorMessage . sprintf("[%s] %s\n", $error['property'], $error['message']);
54
+                        $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']);
55 55
                     }
56
-                    $messageParts[] = $jsonSchemaFile['jsonfilename'] . ' - ' . $jsonSchemaFile['jsonfileurl'] . '(last error: ' . $errorMessage . ').';
56
+                    $messageParts[] = $jsonSchemaFile['jsonfilename'].' - '.$jsonSchemaFile['jsonfileurl'].'(last error: '.$errorMessage.').';
57 57
                 }
58 58
             }
59 59
 
60 60
             if ($errorStatus === true) {
61
-                $message = 'JSON file (' . (string) $response->getUri() . ')  does not validate against the following JSON Schema files: ' . implode(', ', $messageParts);
61
+                $message = 'JSON file ('.(string) $response->getUri().')  does not validate against the following JSON Schema files: '.implode(', ', $messageParts);
62 62
                 throw new ValidationFailedException($message);
63 63
             }
64 64
         }
Please login to merge, or discard this patch.
src/Rules/Security/PasswordSecureTransferRule.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 Psr\Http\Message\ResponseInterface;
6 6
 use Symfony\Component\DomCrawler\Crawler;
7
-use whm\Smoke\Http\Response;
8
-use whm\Smoke\Rules\Rule;
9 7
 use whm\Smoke\Rules\StandardRule;
10 8
 
11 9
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
     protected function doValidation(ResponseInterface $response)
21 21
     {
22
-        $crawler = new Crawler((string)$response->getBody());
22
+        $crawler = new Crawler((string) $response->getBody());
23 23
         $actionNodes = $crawler->filterXPath('//form[//input[@type="password"]]');
24 24
 
25
-        $url = (string)$response->getUri();
25
+        $url = (string) $response->getUri();
26 26
 
27 27
         foreach ($actionNodes as $node) {
28 28
             $action = $node->getAttribute('action');
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
             while ($parent = $parent->parentNode) {
38 38
                 if (property_exists($parent, 'tagName')) {
39
-                    $fullPath = $parent->tagName . '/' . $fullPath;
39
+                    $fullPath = $parent->tagName.'/'.$fullPath;
40 40
                 } else {
41 41
                     break;
42 42
                 }
Please login to merge, or discard this patch.
src/Rules/Seo/PageSpeedRule.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace whm\Smoke\Rules\Seo;
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6
-use whm\Smoke\Http\Response;
7 6
 use whm\Smoke\Rules\Rule;
8 7
 use whm\Smoke\Rules\ValidationFailedException;
9 8
 
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 Ivory\HttpAdapter\HttpAdapterInterface;
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
 
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/StandardRule.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -28,6 +28,10 @@
 block discarded – undo
28 28
 
29 29
     abstract protected function doValidation(ResponseInterface $response);
30 30
 
31
+    /**
32
+     * @param boolean $valueToBeTrue
33
+     * @param string $errorMessage
34
+     */
31 35
     protected function assert($valueToBeTrue, $errorMessage)
32 36
     {
33 37
         if (!$valueToBeTrue) {
Please login to merge, or discard this patch.