GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 665ea8...1b4181 )
by sebastian
15s
created
src/jwk/impl/RSAJWKPEMPrivateKeySpecification.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,15 +36,14 @@
 block discarded – undo
36 36
      * @param string $alg
37 37
      * @param string $use
38 38
      */
39
-    public function __construct
40
-    (
39
+    public function __construct(
41 40
         $key_pem,
42 41
         $password = self::WithoutPassword,
43 42
         $alg = JSONWebSignatureAndEncryptionAlgorithms::RS256,
44 43
         $use = JSONWebKeyPublicKeyUseValues::Signature
45 44
     )
46 45
     {
47
-        parent::__construct($key_pem , $alg, $use);
46
+        parent::__construct($key_pem, $alg, $use);
48 47
         $this->password = $password;
49 48
     }
50 49
     /**
Please login to merge, or discard this patch.
src/jwk/impl/OctetSequenceJWKFactory.php 1 patch
Spacing   +15 added lines, -23 removed lines patch added patch discarded remove patch
@@ -41,28 +41,24 @@  discard block
 block discarded – undo
41 41
     static public function build(IJWKSpecification $spec)
42 42
     {
43 43
 
44
-        if(is_null($spec)) throw new \InvalidArgumentException('missing spec param');
44
+        if (is_null($spec)) throw new \InvalidArgumentException('missing spec param');
45 45
 
46
-        $algorithm = DigitalSignatures_MACs_Registry::getInstance()->get
47
-        (
46
+        $algorithm = DigitalSignatures_MACs_Registry::getInstance()->get(
48 47
             $spec->getAlg()
49 48
         );
50 49
 
51
-        if(is_null($algorithm))
52
-            $algorithm = ContentEncryptionAlgorithms_Registry::getInstance()->get
53
-            (
50
+        if (is_null($algorithm))
51
+            $algorithm = ContentEncryptionAlgorithms_Registry::getInstance()->get(
54 52
                 $spec->getAlg()
55 53
             );
56 54
 
57
-        if(is_null($algorithm))
58
-            $algorithm = KeyManagementAlgorithms_Registry::getInstance()->get
59
-            (
55
+        if (is_null($algorithm))
56
+            $algorithm = KeyManagementAlgorithms_Registry::getInstance()->get(
60 57
                 $spec->getAlg()
61 58
             );
62 59
 
63
-        if(is_null($algorithm))
64
-            throw new InvalidJWKAlgorithm
65
-            (
60
+        if (is_null($algorithm))
61
+            throw new InvalidJWKAlgorithm(
66 62
                 sprintf(
67 63
                     'alg %s not supported!',
68 64
                     $spec->getAlg()
@@ -70,31 +66,27 @@  discard block
 block discarded – undo
70 66
             );
71 67
 
72 68
 
73
-        if($algorithm->getKeyType() !== JSONWebKeyTypes::OctetSequence)
74
-            throw new InvalidJWKAlgorithm
75
-            (
76
-                sprintf
77
-                (
69
+        if ($algorithm->getKeyType() !== JSONWebKeyTypes::OctetSequence)
70
+            throw new InvalidJWKAlgorithm(
71
+                sprintf(
78 72
                     'key type %s not supported!',
79 73
                     $algorithm->getKeyType()
80 74
                 )
81 75
             );
82 76
 
83
-        if(!($spec instanceof OctetSequenceJWKSpecification)) throw new JWKInvalidSpecException;
77
+        if (!($spec instanceof OctetSequenceJWKSpecification)) throw new JWKInvalidSpecException;
84 78
 
85 79
         $shared_secret = $spec->getSharedSecret();
86 80
         $secret_len    = strlen($shared_secret);
87 81
 
88
-        if($secret_len === 0 )
82
+        if ($secret_len === 0)
89 83
         {
90 84
             $generator = Utils_Registry::getInstance()->get(Utils_Registry::RandomNumberGeneratorService);
91 85
             $shared_secret = $generator->invoke($algorithm->getMinKeyLen() / 8);
92 86
         }
93 87
 
94
-        return OctetSequenceJWK::fromSecret
95
-        (
96
-            new SymmetricSharedKey
97
-            (
88
+        return OctetSequenceJWK::fromSecret(
89
+            new SymmetricSharedKey(
98 90
                 $shared_secret
99 91
             ),
100 92
             $spec->getAlg(),
Please login to merge, or discard this patch.
src/jwk/impl/JWKSet.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      * @param JWK[] $keys
43 43
      * @throws JWKInvalidIdentifierException
44 44
      */
45
-    public function __construct(array $keys = array()){
45
+    public function __construct(array $keys = array()) {
46 46
 
47 47
         $this->set[JWKSetParameters::Keys] = new JsonArray(array());
48 48
 
49
-        foreach($keys as $k){
49
+        foreach ($keys as $k) {
50 50
             $this->addKey($k);
51 51
         }
52 52
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function getKeys()
58 58
     {
59
-        if(isset($this->set[JWKSetParameters::Keys]))
59
+        if (isset($this->set[JWKSetParameters::Keys]))
60 60
             return $this->set[JWKSetParameters::Keys]->getValue();
61 61
         return array();
62 62
     }
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $id = $key->getId();
72 72
 
73
-        if(empty($id))
73
+        if (empty($id))
74 74
             throw new JWKInvalidIdentifierException('key id is empty!');
75 75
 
76
-        if(array_key_exists($id->getValue(), $this->keys_ids))
76
+        if (array_key_exists($id->getValue(), $this->keys_ids))
77 77
             throw new JWKInvalidIdentifierException(sprintf('id %s already exists!'), $key->getId()->getValue());
78 78
 
79
-        if(!isset($this->set[JWKSetParameters::Keys]))
79
+        if (!isset($this->set[JWKSetParameters::Keys]))
80 80
             $this->set[JWKSetParameters::Keys] = new JsonArray(array());
81 81
 
82 82
         $keys = $this->set[JWKSetParameters::Keys];
83 83
         $keys->append($key);
84
-        $this->set[JWKSetParameters::Keys] = $keys ;
84
+        $this->set[JWKSetParameters::Keys] = $keys;
85 85
         $this->keys_ids[$id->getValue()] = $key;
86 86
     }
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function getKeyById($kid)
93 93
     {
94
-        if(!array_key_exists($kid, $this->keys_ids)) return null;
94
+        if (!array_key_exists($kid, $this->keys_ids)) return null;
95 95
         return $this->keys_ids[$kid];
96 96
     }
97 97
 
@@ -101,27 +101,27 @@  discard block
 block discarded – undo
101 101
      * @throws InvalidJWKAlgorithm
102 102
      * @throws JWKInvalidIdentifierException
103 103
      */
104
-    static public function fromJson($json){
105
-        $json = str_replace( array("\n","\r","\t"), '', trim($json));
104
+    static public function fromJson($json) {
105
+        $json = str_replace(array("\n", "\r", "\t"), '', trim($json));
106 106
         $res  = json_decode($json, true);
107
-        if(!isset($res[JWKSetParameters::Keys])) throw new JWKInvalidIdentifierException;
107
+        if (!isset($res[JWKSetParameters::Keys])) throw new JWKInvalidIdentifierException;
108 108
         $keys = $res[JWKSetParameters::Keys];
109 109
         $jwk_set = new JWKSet;
110
-        foreach($keys as $key){
110
+        foreach ($keys as $key) {
111 111
             $kty = @$key[JSONWebKeyParameters::KeyType];
112 112
             $kid = @$key[JSONWebKeyParameters::KeyId];
113 113
             $use = @$key[JSONWebKeyParameters::PublicKeyUse];
114 114
             $alg = @$key[JSONWebKeyParameters::Algorithm];
115
-            if(empty($alg)) $alg = JSONWebSignatureAndEncryptionAlgorithms::RS256;
115
+            if (empty($alg)) $alg = JSONWebSignatureAndEncryptionAlgorithms::RS256;
116 116
 
117
-            if(empty($kty) || empty($kid) || empty($use)) continue;
117
+            if (empty($kty) || empty($kid) || empty($use)) continue;
118 118
 
119
-            if(!in_array($kty, JSONWebKeyTypes::$supported_keys)) continue;
119
+            if (!in_array($kty, JSONWebKeyTypes::$supported_keys)) continue;
120 120
 
121 121
             $n        = @$key[RSAKeysParameters::Modulus];
122 122
             $e        = @$key[RSAKeysParameters::Exponent];
123 123
             $x5c      = @$key[PublicJSONWebKeyParameters::X_509CertificateChain];
124
-            if(is_null($x5c)) $x5c = array();
124
+            if (is_null($x5c)) $x5c = array();
125 125
             $x5u      = @$key[PublicJSONWebKeyParameters::X_509Url];
126 126
             $x5t      = @$key[PublicJSONWebKeyParameters::X_509CertificateSHA_1_Thumbprint];
127 127
             $x5t_S256 = @$key[PublicJSONWebKeyParameters::X_509CertificateSHA_256_Thumbprint];
Please login to merge, or discard this patch.
src/jwk/impl/RSAJWKFactory.php 1 patch
Spacing   +11 added lines, -16 removed lines patch added patch discarded remove patch
@@ -41,30 +41,26 @@  discard block
 block discarded – undo
41 41
     static public function build(IJWKSpecification $spec)
42 42
     {
43 43
 
44
-        if(is_null($spec)) throw new \InvalidArgumentException('missing spec param');
44
+        if (is_null($spec)) throw new \InvalidArgumentException('missing spec param');
45 45
 
46 46
         $algorithm = DigitalSignatures_MACs_Registry::getInstance()->get($spec->getAlg());
47 47
 
48
-        if(is_null($algorithm))
48
+        if (is_null($algorithm))
49 49
         {
50 50
             $algorithm = KeyManagementAlgorithms_Registry::getInstance()->get($spec->getAlg());
51 51
         }
52 52
 
53
-        if(is_null($algorithm))
54
-            throw new InvalidJWKAlgorithm
55
-            (
56
-                sprintf
57
-                (
53
+        if (is_null($algorithm))
54
+            throw new InvalidJWKAlgorithm(
55
+                sprintf(
58 56
                     'alg %s not supported!',
59 57
                     $spec->getAlg()
60 58
                 )
61 59
             );
62 60
 
63
-        if($algorithm->getKeyType() !== JSONWebKeyTypes::RSA)
64
-            throw new InvalidJWKAlgorithm
65
-            (
66
-                sprintf
67
-                (
61
+        if ($algorithm->getKeyType() !== JSONWebKeyTypes::RSA)
62
+            throw new InvalidJWKAlgorithm(
63
+                sprintf(
68 64
                     'key type %s not supported!',
69 65
                     $algorithm->getKeyType()
70 66
                 )
@@ -79,11 +75,10 @@  discard block
 block discarded – undo
79 75
             $jwk->setKeyUse($spec->getUse());
80 76
             return $jwk;
81 77
         }
82
-        if($spec instanceof RSAJWKParamsPublicKeySpecification)
78
+        if ($spec instanceof RSAJWKParamsPublicKeySpecification)
83 79
         {
84 80
 
85
-            $public_key = RSAFacade::getInstance()->buildPublicKey
86
-            (
81
+            $public_key = RSAFacade::getInstance()->buildPublicKey(
87 82
                 $spec->getModulus()->toBigInt(),
88 83
                 $spec->getExponent()->toBigInt()
89 84
             );
@@ -96,7 +91,7 @@  discard block
 block discarded – undo
96 91
 
97 92
             return $jwk;
98 93
         }
99
-        if($spec instanceof RSAJWKPEMPublicKeySpecification)
94
+        if ($spec instanceof RSAJWKPEMPublicKeySpecification)
100 95
         {
101 96
             $public_key = RSAFacade::getInstance()->buildPublicKeyFromPEM($spec->getPEM());
102 97
             $jwk = RSAJWK::fromPublicKey($public_key);
Please login to merge, or discard this patch.
src/jwk/impl/RSAJWKParamsPublicKeySpecification.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,42 +92,42 @@
 block discarded – undo
92 92
     /**
93 93
      * @return Base64urlUInt
94 94
      */
95
-    public function getModulus(){
95
+    public function getModulus() {
96 96
         return new Base64urlUInt($this->n_b64);
97 97
     }
98 98
 
99 99
     /**
100 100
      * @return Base64urlUInt
101 101
      */
102
-    public function getExponent(){
102
+    public function getExponent() {
103 103
         return new Base64urlUInt($this->e_b64);
104 104
     }
105 105
 
106 106
     /**
107 107
      * @return array
108 108
      */
109
-    public function getX509CertificateChain(){
109
+    public function getX509CertificateChain() {
110 110
         return $this->x5c;
111 111
     }
112 112
 
113 113
     /**
114 114
      * @return null|string
115 115
      */
116
-    public function getX509Url(){
116
+    public function getX509Url() {
117 117
         return $this->x5u;
118 118
     }
119 119
 
120 120
     /**
121 121
      * @return null|string
122 122
      */
123
-    public function getX509CertificateSHA_1_Thumbprint(){
123
+    public function getX509CertificateSHA_1_Thumbprint() {
124 124
         return $this->x5t;
125 125
     }
126 126
 
127 127
     /**
128 128
      * @return null|string
129 129
      */
130
-    public function getX509CertificateSHA_256_Thumbprint(){
130
+    public function getX509CertificateSHA_256_Thumbprint() {
131 131
         return $this->x5t_S256;
132 132
     }
133 133
 }
134 134
\ No newline at end of file
Please login to merge, or discard this patch.
src/jwk/impl/RSAJWKPEMKeySpecification.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
      * @param string $alg
35 35
      * @param string $use
36 36
      */
37
-    public function __construct
38
-    (
37
+    public function __construct(
39 38
         $key_pem,
40 39
         $alg = JSONWebSignatureAndEncryptionAlgorithms::RS256,
41 40
         $use = JSONWebKeyPublicKeyUseValues::Signature
Please login to merge, or discard this patch.
src/jwk/impl/RSAJWKSpecification.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,14 +32,13 @@
 block discarded – undo
32 32
      * @param string $kid
33 33
      * @throws InvalidJWKAlgorithm
34 34
      */
35
-    public function __construct
36
-    (
35
+    public function __construct(
37 36
         $alg = JSONWebSignatureAndEncryptionAlgorithms::RS256,
38 37
         $use = JSONWebKeyPublicKeyUseValues::Signature,
39 38
         $kid = null
40 39
     )
41 40
     {
42
-        if(!empty($alg) && !in_array($alg, RSAKeysParameters::$valid_algorithms_values))
41
+        if (!empty($alg) && !in_array($alg, RSAKeysParameters::$valid_algorithms_values))
43 42
             throw new InvalidJWKAlgorithm(sprintf('alg %s', $alg));
44 43
 
45 44
         parent::__construct($alg, $use, $kid);
Please login to merge, or discard this patch.
src/jwk/impl/OctetSequenceJWKSpecification.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,14 +38,13 @@
 block discarded – undo
38 38
      * @param string $use
39 39
      * @throws InvalidJWKAlgorithm
40 40
      */
41
-    public function __construct
42
-    (
41
+    public function __construct(
43 42
         $shared_secret = self::GenerateSecret,
44 43
         $alg = JSONWebSignatureAndEncryptionAlgorithms::HS256,
45 44
         $use = JSONWebKeyPublicKeyUseValues::Signature
46 45
     )
47 46
     {
48
-        if(!in_array($alg, OctetSequenceKeysParameters::$valid_algorithms_values))
47
+        if (!in_array($alg, OctetSequenceKeysParameters::$valid_algorithms_values))
49 48
             throw new InvalidJWKAlgorithm(sprintf('alg %s', $alg));
50 49
 
51 50
         parent::__construct($alg, $use);
Please login to merge, or discard this patch.
src/jwk/impl/RSAJWK.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
      */
113 113
     static public function fromKeys(KeyPair $keys)
114 114
     {
115
-        if(!($keys->getPrivate() instanceof RSAPrivateKey))
115
+        if (!($keys->getPrivate() instanceof RSAPrivateKey))
116 116
             throw new \RuntimeException('Private key of invalid type!');
117 117
 
118
-        if(!($keys->getPublic() instanceof RSAPublicKey))
118
+        if (!($keys->getPublic() instanceof RSAPublicKey))
119 119
             throw new \RuntimeException('Public key of invalid type!');
120 120
 
121 121
         $jwk                                          = new RSAJWK();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getKey($key_op = JSONWebKeyKeyOperationsValues::ComputeDigitalSignatureOrMAC)
167 167
     {
168
-        switch($key_op){
168
+        switch ($key_op) {
169 169
             case JSONWebKeyKeyOperationsValues::ComputeDigitalSignatureOrMAC:
170 170
             case JSONWebKeyKeyOperationsValues::DecryptContentAndValidateDecryption: {
171 171
                 return $this->getPrivateKey();
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             }
178 178
             break;
179 179
             default:{
180
-                throw new InvalidJWKUseException(sprintf('key_op %s',  $key_op));
180
+                throw new InvalidJWKUseException(sprintf('key_op %s', $key_op));
181 181
             }
182 182
             break;
183 183
         }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     public function toArray()
191 191
     {
192 192
         $res = parent::toArray();
193
-        if($this->visibility === JSONWebKeyVisibility::PublicOnly){
193
+        if ($this->visibility === JSONWebKeyVisibility::PublicOnly) {
194 194
             //remove private attributes
195 195
             unset($res[RSAKeysParameters::PrivateExponent]);
196 196
             unset($res[RSAKeysParameters::FirstPrimeFactor]);
Please login to merge, or discard this patch.