Test Failed
Branch master (90c1c3)
by Fabian
03:08
created
src/LE_ACME2/Response/Authorization/Get.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,24 +32,24 @@
 block discarded – undo
32 32
      */
33 33
     public function getChallenge(string $type) : ?Struct\Challenge {
34 34
 
35
-        foreach($this->getChallenges() as $challenge) {
35
+        foreach ($this->getChallenges() as $challenge) {
36 36
 
37
-            if($type == $challenge['type']) {
37
+            if ($type == $challenge['type']) {
38 38
 
39 39
                 $error = null;
40
-                if(isset($challenge[ 'error' ]) && $challenge[ 'error' ] != "") {
40
+                if (isset($challenge['error']) && $challenge['error'] != "") {
41 41
                     $error = new Struct\ChallengeError(
42
-                        $challenge[ 'error' ][ 'type' ],
43
-                        $challenge[ 'error' ][ 'detail' ],
44
-                        $challenge[ 'error' ][ 'status' ],
42
+                        $challenge['error']['type'],
43
+                        $challenge['error']['detail'],
44
+                        $challenge['error']['status'],
45 45
                     );
46 46
                 }
47 47
 
48 48
                 return new Struct\Challenge(
49
-                    $challenge[ 'type' ],
50
-                    $challenge[ 'status' ],
51
-                    $challenge[ 'url' ],
52
-                    $challenge[ 'token' ],
49
+                    $challenge['type'],
50
+                    $challenge['status'],
51
+                    $challenge['url'],
52
+                    $challenge['token'],
53 53
                     $error,
54 54
                 );
55 55
             }
Please login to merge, or discard this patch.
src/LE_ACME2/Response/Authorization/AbstractAuthorization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     protected function _isValid() : bool {
37 37
 
38
-        if($this->_preg_match_headerLine('/^HTTP\/.* 404/i') !== null) {
38
+        if ($this->_preg_match_headerLine('/^HTTP\/.* 404/i') !== null) {
39 39
             throw new Exception\ExpiredAuthorization();
40 40
         }
41 41
 
Please login to merge, or discard this patch.
src/LE_ACME2/Response/AbstractResponse.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 
24 24
         $this->_raw = $raw;
25 25
 
26
-        if($this->_isRateLimitReached()) {
26
+        if ($this->_isRateLimitReached()) {
27 27
 
28 28
             $detail = "";
29
-            if(isset($raw->body['type']) && $raw->body['type'] == 'urn:ietf:params:acme:error:rateLimited') {
29
+            if (isset($raw->body['type']) && $raw->body['type'] == 'urn:ietf:params:acme:error:rateLimited') {
30 30
                 $detail = $raw->body['detail'];
31 31
             }
32 32
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         }
35 35
 
36 36
         $result = $this->_isValid();
37
-        if(!$result) {
37
+        if (!$result) {
38 38
 
39 39
             $responseStatus = $this->_preg_match_headerLine('/^HTTP\/.* [0-9]{3,} /i');
40 40
             throw new Exception\InvalidResponse(
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
     protected function _preg_match_headerLine(string $pattern) : ?array {
48 48
 
49
-        foreach($this->_raw->header as $line) {
49
+        foreach ($this->_raw->header as $line) {
50 50
 
51
-            if(preg_match($pattern, $line, $matches) === 1)
51
+            if (preg_match($pattern, $line, $matches) === 1)
52 52
                 return $matches;
53 53
         }
54 54
         return null;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,9 @@
 block discarded – undo
48 48
 
49 49
         foreach($this->_raw->header as $line) {
50 50
 
51
-            if(preg_match($pattern, $line, $matches) === 1)
52
-                return $matches;
51
+            if(preg_match($pattern, $line, $matches) === 1) {
52
+                            return $matches;
53
+            }
53 54
         }
54 55
         return null;
55 56
     }
Please login to merge, or discard this patch.
src/LE_ACME2/Utilities/RequestSigner.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $payload64 = Base64::UrlSafeEncode(str_replace('\\/', '/', json_encode($payload)));
37 37
         $protected64 = Base64::UrlSafeEncode(json_encode($protected));
38 38
 
39
-        openssl_sign($protected64.'.'.$payload64, $signed, $privateKey, "SHA256");
39
+        openssl_sign($protected64 . '.' . $payload64, $signed, $privateKey, "SHA256");
40 40
         $signed64 = Base64::UrlSafeEncode($signed);
41 41
 
42 42
         $data = array(
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $payload64 = Base64::UrlSafeEncode($payload);
99 99
         $protected64 = Base64::UrlSafeEncode(json_encode($protected));
100 100
 
101
-        openssl_sign($protected64.'.'.$payload64, $signed, $privateKey, "SHA256");
101
+        openssl_sign($protected64 . '.' . $payload64, $signed, $privateKey, "SHA256");
102 102
         $signed64 = Base64::UrlSafeEncode($signed);
103 103
 
104 104
         $data = [
Please login to merge, or discard this patch.
src/LE_ACME2/Utilities/Certificate.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             "commonName" => $order->getSubjects()[0]
29 29
         ];
30 30
 
31
-        $san = implode(",", array_map(function ($dns) {
31
+        $san = implode(",", array_map(function($dns) {
32 32
 
33 33
                 return "DNS:" . $dns;
34 34
             }, $order->getSubjects())
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			subjectAltName = ' . $san . '
51 51
 			keyUsage = nonRepudiation, digitalSignature, keyEncipherment';
52 52
 
53
-        if(self::$_featureOCSPMustStapleEnabled) {
53
+        if (self::$_featureOCSPMustStapleEnabled) {
54 54
             $config .= PHP_EOL . 'tlsfeature=status_request';
55 55
         }
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             file_get_contents($order->getKeyDirectoryPath() . 'private.pem')
61 61
         );
62 62
 
63
-        if($privateKey === false) {
63
+        if ($privateKey === false) {
64 64
             throw new OpenSSLException('openssl_pkey_get_private');
65 65
         }
66 66
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
             ]
74 74
         );
75 75
 
76
-        if($csr === false) {
76
+        if ($csr === false) {
77 77
             throw new OpenSSLException('openssl_csr_new');
78 78
         }
79 79
 
80
-        if(!openssl_csr_export($csr, $csr)) {
80
+        if (!openssl_csr_export($csr, $csr)) {
81 81
             throw new OpenSSLException('openssl_csr_export');
82 82
         }
83 83
 
Please login to merge, or discard this patch.
src/LE_ACME2/Utilities/ChallengeHTTP.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
         $response = curl_exec($handle);
23 23
 
24
-        if(curl_errno($handle)) {
24
+        if (curl_errno($handle)) {
25 25
 
26 26
             throw new Exception\HTTPAuthorizationInvalid(
27 27
                 'Error while testing HTTP challenge for "' . $domain . '"": ' .
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         }
32 32
 
33 33
         $statusCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
34
-        if(substr($statusCode, 0, 1) != 2) {
34
+        if (substr($statusCode, 0, 1) != 2) {
35 35
             throw new Exception\HTTPAuthorizationInvalid(
36 36
                 'Error while testing HTTP challenge for "' . $domain . '"": ' .
37 37
                 $domain . '/.well-known/acme-challenge/' . $token .
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             );
40 40
         }
41 41
 
42
-        if($response === false) {
42
+        if ($response === false) {
43 43
             throw new Exception\HTTPAuthorizationInvalid(
44 44
                 'HTTP challenge for "' . $domain . '"": ' .
45 45
                 $domain . '/.well-known/acme-challenge/' . $token .
Please login to merge, or discard this patch.
src/LE_ACME2/Utilities/Logger.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function add(int $level, string $message, array $data = array()) {
39 39
 
40
-        if($level > $this->_desiredLevel)
40
+        if ($level > $this->_desiredLevel)
41 41
             return;
42 42
 
43
-        if($this->_psrLogger) {
43
+        if ($this->_psrLogger) {
44 44
 
45
-            if($level == self::LEVEL_INFO) {
45
+            if ($level == self::LEVEL_INFO) {
46 46
                 $this->_psrLogger->info($message, $data);
47 47
                 return;
48 48
             }
49
-            if($level == self::LEVEL_DEBUG) {
49
+            if ($level == self::LEVEL_DEBUG) {
50 50
                 $this->_psrLogger->debug($message, $data);
51 51
                 return;
52 52
             }
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 
60 60
         $output = '<b>' . date('d-m-Y H:i:s') . ': ' . $message . '</b><br>' . "\n";
61 61
 
62
-        if($this->_desiredLevel == self::LEVEL_DEBUG) {
62
+        if ($this->_desiredLevel == self::LEVEL_DEBUG) {
63 63
 
64 64
             $step = 0;
65 65
             foreach ($trace as $traceItem) {
66 66
 
67
-                if(!isset($traceItem['class']) || !isset($traceItem['function'])) {
67
+                if (!isset($traceItem['class']) || !isset($traceItem['function'])) {
68 68
                     continue;
69 69
                 }
70 70
 
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
             }
74 74
 
75 75
             if ((is_array($data) && count($data) > 0) || !is_array($data))
76
-                $output .= "\n" .'<br/>Data:<br/>' . "\n" . '<pre>' . var_export($data, true) . '</pre>';
76
+                $output .= "\n" . '<br/>Data:<br/>' . "\n" . '<pre>' . var_export($data, true) . '</pre>';
77 77
 
78 78
             $output .= '<br><br>' . "\n\n";
79 79
         }
80 80
 
81
-        if(PHP_SAPI == 'cli') {
81
+        if (PHP_SAPI == 'cli') {
82 82
 
83 83
             $output = strip_tags($output);
84 84
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function add(int $level, string $message, array $data = array()) {
39 39
 
40
-        if($level > $this->_desiredLevel)
41
-            return;
40
+        if($level > $this->_desiredLevel) {
41
+                    return;
42
+        }
42 43
 
43 44
         if($this->_psrLogger) {
44 45
 
@@ -72,8 +73,9 @@  discard block
 block discarded – undo
72 73
                 $step++;
73 74
             }
74 75
 
75
-            if ((is_array($data) && count($data) > 0) || !is_array($data))
76
-                $output .= "\n" .'<br/>Data:<br/>' . "\n" . '<pre>' . var_export($data, true) . '</pre>';
76
+            if ((is_array($data) && count($data) > 0) || !is_array($data)) {
77
+                            $output .= "\n" .'<br/>Data:<br/>' . "\n" . '<pre>' . var_export($data, true) . '</pre>';
78
+            }
77 79
 
78 80
             $output .= '<br><br>' . "\n\n";
79 81
         }
Please login to merge, or discard this patch.
src/LE_ACME2/Utilities/KeyGenerator.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             "private_key_bits" => 4096,
19 19
         ]);
20 20
 
21
-        if(!openssl_pkey_export($res, $privateKey))
21
+        if (!openssl_pkey_export($res, $privateKey))
22 22
             throw new \RuntimeException("RSA keypair export failed!");
23 23
 
24 24
         $details = openssl_pkey_get_details($res);
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         file_put_contents($directory . $privateKeyFile, $privateKey);
27 27
         file_put_contents($directory . $publicKeyFile, $details['key']);
28 28
 
29
-        if(PHP_MAJOR_VERSION < 8) {
29
+        if (PHP_MAJOR_VERSION < 8) {
30 30
             // deprecated after PHP 8.0.0 and not needed anymore
31 31
             openssl_pkey_free($res);
32 32
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             "curve_name" => "prime256v1",
50 50
         ]);
51 51
 
52
-        if(!openssl_pkey_export($res, $privateKey))
52
+        if (!openssl_pkey_export($res, $privateKey))
53 53
             throw new \RuntimeException("EC keypair export failed!");
54 54
 
55 55
         $details = openssl_pkey_get_details($res);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         file_put_contents($directory . $privateKeyFile, $privateKey);
58 58
         file_put_contents($directory . $publicKeyFile, $details['key']);
59 59
 
60
-        if(PHP_MAJOR_VERSION < 8) {
60
+        if (PHP_MAJOR_VERSION < 8) {
61 61
             // deprecated after PHP 8.0.0 and not needed anymore
62 62
             openssl_pkey_free($res);
63 63
         }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
             "private_key_bits" => 4096,
19 19
         ]);
20 20
 
21
-        if(!openssl_pkey_export($res, $privateKey))
22
-            throw new \RuntimeException("RSA keypair export failed!");
21
+        if(!openssl_pkey_export($res, $privateKey)) {
22
+                    throw new \RuntimeException("RSA keypair export failed!");
23
+        }
23 24
 
24 25
         $details = openssl_pkey_get_details($res);
25 26
 
@@ -41,16 +42,18 @@  discard block
 block discarded – undo
41 42
      */
42 43
     public static function EC(string $directory, string $privateKeyFile = 'private.pem', string $publicKeyFile = 'public.pem') {
43 44
 
44
-        if (version_compare(PHP_VERSION, '7.1.0') == -1)
45
-            throw new \RuntimeException("PHP 7.1+ required for EC keys");
45
+        if (version_compare(PHP_VERSION, '7.1.0') == -1) {
46
+                    throw new \RuntimeException("PHP 7.1+ required for EC keys");
47
+        }
46 48
 
47 49
         $res = openssl_pkey_new([
48 50
             "private_key_type" => OPENSSL_KEYTYPE_EC,
49 51
             "curve_name" => "prime256v1",
50 52
         ]);
51 53
 
52
-        if(!openssl_pkey_export($res, $privateKey))
53
-            throw new \RuntimeException("EC keypair export failed!");
54
+        if(!openssl_pkey_export($res, $privateKey)) {
55
+                    throw new \RuntimeException("EC keypair export failed!");
56
+        }
54 57
 
55 58
         $details = openssl_pkey_get_details($res);
56 59
 
Please login to merge, or discard this patch.
src/LE_ACME2/Utilities/Event.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function subscribe(string $event, callable $callable) : void {
20 20
 
21
-        if(!isset($this->_subscriber[$event])) {
21
+        if (!isset($this->_subscriber[$event])) {
22 22
             $this->_subscriber[$event] = [];
23 23
         }
24 24
 
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 
30 30
         Logger::getInstance()->add(Logger::LEVEL_DEBUG, 'Event triggered: ' . $event);
31 31
 
32
-        if(!$this->_subscriber[$event]) {
32
+        if (!$this->_subscriber[$event]) {
33 33
             return;
34 34
         }
35 35
 
36
-        foreach($this->_subscriber[$event] as $callable) {
36
+        foreach ($this->_subscriber[$event] as $callable) {
37 37
             $callable($event, $payload);
38 38
         }
39 39
     }
Please login to merge, or discard this patch.