Completed
Push — master ( 7c338b...cf31cf )
by Nils
02:12
created
src/Rules/Xml/XmlCheckRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
         if (!$success) {
22 22
             $lastError = libxml_get_last_error();
23 23
 
24
-            throw new ValidationFailedException('The xml file ' . $response->getUri() . ' is not well formed (last error: ' .
25
-                str_replace("\n", '', $lastError->message) . ').');
24
+            throw new ValidationFailedException('The xml file '.$response->getUri().' is not well formed (last error: '.
25
+                str_replace("\n", '', $lastError->message).').');
26 26
         }
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Rules/Html/CssSelectorExistsRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         if ($error === true) {
47 47
             $allNotFoundSelectors = implode('", "', $snotFoundSelectors);
48 48
 
49
-            throw new ValidationFailedException('CSS Selector "' . $allNotFoundSelectors . '" not found in DOM.');
49
+            throw new ValidationFailedException('CSS Selector "'.$allNotFoundSelectors.'" not found in DOM.');
50 50
         }
51 51
     }
52 52
 }
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
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     {
24 24
         if (strpos($response->getContentType(), 'image') === false
25 25
             && strpos($response->getContentType(), 'pdf') === false
26
-            && strlen((string)$response->getBody()) >= $this->minFileSize
26
+            && strlen((string) $response->getBody()) >= $this->minFileSize
27 27
         ) {
28 28
             if (!$response->hasHeader('Content-Encoding') || $response->getHeader('Content-Encoding')[0] !== 'gzip') {
29 29
                 throw new ValidationFailedException('gzip compression not active');
Please login to merge, or discard this patch.
src/Rules/Json/JsonSchema/JsonSchemaRule.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $data = json_decode($response->getBody());
40 40
         if ($data === null) {
41
-            throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "').");
41
+            throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."').");
42 42
         }
43 43
         else {
44 44
             $error = false;
45 45
             $messageParts = array();
46 46
 
47 47
             foreach ($this->jsonSchemaFiles AS $jsonSchemaFile) {
48
-                $factory = new Factory( null, null, Constraint::CHECK_MODE_TYPE_CAST | Constraint::CHECK_MODE_COERCE );
48
+                $factory = new Factory(null, null, Constraint::CHECK_MODE_TYPE_CAST | Constraint::CHECK_MODE_COERCE);
49 49
                 $validator = new Validator($factory);
50 50
 
51
-                $jsonSchemaObject = (object)json_decode(file_get_contents($jsonSchemaFile['jsonschemafileurl']));
51
+                $jsonSchemaObject = (object) json_decode(file_get_contents($jsonSchemaFile['jsonschemafileurl']));
52 52
                 
53 53
                 $validator->check($data, $jsonSchemaObject);
54 54
 
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
                     $error = true;
57 57
                     $errorMessage = '';
58 58
                     foreach ($validator->getErrors() as $error) {
59
-                        $errorMessage = $errorMessage .  sprintf("[%s] %s\n", $error['property'], $error['message']);
59
+                        $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']);
60 60
                     }
61
-                    $messageParts[] = $jsonSchemaFile['jsonschemafilename'] . ' - ' . $jsonSchemaFile['jsonschemafileurl'] . '(last error: ' . $errorMessage . ').';
61
+                    $messageParts[] = $jsonSchemaFile['jsonschemafilename'].' - '.$jsonSchemaFile['jsonschemafileurl'].'(last error: '.$errorMessage.').';
62 62
                 }
63 63
             }
64 64
 
65 65
             if ($error == true) {
66
-                $message = 'JSON file (' . (string)$response->getUri() . ')  does not validate against the following JSON Schema files: ' . implode(", ", $messageParts);
66
+                $message = 'JSON file ('.(string) $response->getUri().')  does not validate against the following JSON Schema files: '.implode(", ", $messageParts);
67 67
                 throw new ValidationFailedException($message);
68 68
             }
69 69
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@
 block discarded – undo
39 39
         $data = json_decode($response->getBody());
40 40
         if ($data === null) {
41 41
             throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "').");
42
-        }
43
-        else {
42
+        } else {
44 43
             $error = false;
45 44
             $messageParts = array();
46 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
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $dom = new \DOMDocument();
28 28
         @$dom->loadXML($body);
29 29
 
30
-        $filename = (string)$response->getUri();
30
+        $filename = (string) $response->getUri();
31 31
 
32 32
         $error = false;
33 33
         $messageParts = array();
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
                 $error = true;
40 40
                 $lastError = libxml_get_last_error();
41 41
 
42
-                $messageParts[] = $xsdFile['xsdfilename'] . ' - ' . $xsdFile['xsdfileurl'] . '(last error: ' . str_replace("\n", '', $lastError->message) . ').';
42
+                $messageParts[] = $xsdFile['xsdfilename'].' - '.$xsdFile['xsdfileurl'].'(last error: '.str_replace("\n", '', $lastError->message).').';
43 43
             }
44 44
         }
45 45
 
46 46
         if ($error === true) {
47
-            $message = 'XML file (' . $filename . ')  does not validate against the following XSD files: ' . implode(", ", $messageParts);
47
+            $message = 'XML file ('.$filename.')  does not validate against the following XSD files: '.implode(", ", $messageParts);
48 48
             throw new ValidationFailedException($message);
49 49
         }
50 50
     }
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
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public function validate(Response $response)
15 15
     {
16
-        $url = $response->getUri()->getScheme() . '://' . $response->getUri()->getHost();
16
+        $url = $response->getUri()->getScheme().'://'.$response->getUri()->getHost();
17 17
 
18 18
         if (substr_count($url, '/') === 2) {
19
-            $filename = $robotsUrl = $url . '/robots.txt';
19
+            $filename = $robotsUrl = $url.'/robots.txt';
20 20
         } elseif (substr_count($url, '/') === 3) {
21
-            $filename = $robotsUrl = $url . 'robots.txt';
21
+            $filename = $robotsUrl = $url.'robots.txt';
22 22
         } else {
23 23
             return;
24 24
         }
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             $content = file_get_contents($filename);
31 31
             $normalizedContent = strtolower(str_replace(' ', '', $content));
32 32
 
33
-            if (strpos($normalizedContent, 'disallow:/' . PHP_EOL) !== false) {
33
+            if (strpos($normalizedContent, 'disallow:/'.PHP_EOL) !== false) {
34 34
                 throw new ValidationFailedException('The robots.txt contains disallow all (Disallow: /)');
35 35
             }
36 36
 
Please login to merge, or discard this patch.
src/Rules/Json/JsonPathExistsRule.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,13 +53,13 @@
 block discarded – undo
53 53
 
54 54
     public function doValidation(Response $response)
55 55
     {
56
-	$body = (string)$response->getBody();
56
+    $body = (string)$response->getBody();
57 57
 
58 58
         $json = json_decode($body);
59 59
 
60
-	if(!$json) {
61
- 	    throw new ValidationFailedException('The given json document is empty or not valid json.');
62
-	}
60
+    if(!$json) {
61
+            throw new ValidationFailedException('The given json document is empty or not valid json.');
62
+    }
63 63
 
64 64
         $store = new JsonStore($json);
65 65
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function doValidation(Response $response)
55 55
     {
56
-	$body = (string)$response->getBody();
56
+	$body = (string) $response->getBody();
57 57
 
58 58
         $json = json_decode($body);
59 59
 
60
-	if(!$json) {
60
+	if (!$json) {
61 61
  	    throw new ValidationFailedException('The given json document is empty or not valid json.');
62 62
 	}
63 63
 
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 
73 73
             if ($jsonValue === FALSE || (is_array($jsonValue) && empty($jsonValue))) {
74 74
                 $error = true;
75
-                $noCorrectJsonPaths[] = $path['pattern'] . ' (JSON Path not found)';
75
+                $noCorrectJsonPaths[] = $path['pattern'].' (JSON Path not found)';
76 76
             }
77 77
             if ($this->checkRelation($path['relation'], $path['value'], $count) === false) {
78 78
                 $error = true;
79
-                $noCorrectJsonPaths[] = $path['pattern'] . ' (number of JSONPaths is not correct corresponding to the given relation/value)';
79
+                $noCorrectJsonPaths[] = $path['pattern'].' (number of JSONPaths is not correct corresponding to the given relation/value)';
80 80
             }
81 81
         }
82 82
 
83 83
         if ($error === true) {
84 84
             $allNoCorrectJsonPaths = implode('", "', $noCorrectJsonPaths);
85
-            throw new ValidationFailedException('Disonances with JSON Paths "' . $allNoCorrectJsonPaths . '!');
85
+            throw new ValidationFailedException('Disonances with JSON Paths "'.$allNoCorrectJsonPaths.'!');
86 86
         }
87 87
     }
88 88
 }
Please login to merge, or discard this patch.