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 ( 1bd209...b712a4 )
by Jared
04:45
created
src/JCFirebase.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@
 block discarded – undo
43 43
         $this->setAuth($firebaseSerivceAccount);
44 44
     }
45 45
 
46
+    /**
47
+     * @param string $firebaseServiceAccount
48
+     */
46 49
     public function setAuth($firebaseServiceAccount){
47 50
         if(isset($firebaseServiceAccount['key']) && isset($firebaseServiceAccount['iss'])){
48 51
             $this->auth = new OAuth($firebaseServiceAccount['key'],$firebaseServiceAccount['iss']);
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -36,37 +36,37 @@  discard block
 block discarded – undo
36 36
 
37 37
     public $requestOptions = array();
38 38
 
39
-    public function __construct($firebaseURI,$firebaseSerivceAccount = '',$firebaseDefaultPath = '/')
39
+    public function __construct($firebaseURI, $firebaseSerivceAccount = '', $firebaseDefaultPath = '/')
40 40
     {
41 41
         $this->firebaseURI = $firebaseURI;
42 42
         $this->firebaseDefaultPath = $firebaseDefaultPath;
43 43
         $this->setAuth($firebaseSerivceAccount);
44 44
     }
45 45
 
46
-    public function setAuth($firebaseServiceAccount){
47
-        if(isset($firebaseServiceAccount['key']) && isset($firebaseServiceAccount['iss'])){
48
-            $this->auth = new OAuth($firebaseServiceAccount['key'],$firebaseServiceAccount['iss']);
46
+    public function setAuth($firebaseServiceAccount) {
47
+        if (isset($firebaseServiceAccount['key']) && isset($firebaseServiceAccount['iss'])) {
48
+            $this->auth = new OAuth($firebaseServiceAccount['key'], $firebaseServiceAccount['iss']);
49 49
         }
50 50
     }
51 51
 
52
-    public function getPathURI($path = '',$print = ''){
52
+    public function getPathURI($path = '', $print = '') {
53 53
         //remove last slash from firebaseURI
54 54
         $template = '/';
55
-	    $this->firebaseURI = rtrim($this->firebaseURI,$template);
56
-	    $path = rtrim($path,$template);
57
-	    $path = ltrim($path,$template);
55
+	    $this->firebaseURI = rtrim($this->firebaseURI, $template);
56
+	    $path = rtrim($path, $template);
57
+	    $path = ltrim($path, $template);
58 58
 
59 59
         //check https
60
-        if(strpos($this->firebaseURI, 'http://') !== false){
60
+        if (strpos($this->firebaseURI, 'http://') !== false) {
61 61
             throw new \Exception("https is required.");
62 62
         }
63 63
 
64 64
         //check firebaseURI
65
-        if(empty($this->firebaseURI)){
65
+        if (empty($this->firebaseURI)) {
66 66
             throw new \Exception("firebase URI is required");
67 67
         }
68 68
 
69
-        if(strpos($this->firebaseDefaultPath,"/") !== 0){
69
+        if (strpos($this->firebaseDefaultPath, "/") !== 0) {
70 70
         	throw new \Exception("firebase default path must contain /");
71 71
         }
72 72
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 
75 75
         //set query data
76 76
         $queryData = array();
77
-        if(!empty($print)){
77
+        if (!empty($print)) {
78 78
             $queryData[JCFirebaseOption::OPTION_PRINT] = $print;
79 79
         }
80
-        if(!empty($queryData)){
81
-            $pathURI = $pathURI . '?' . http_build_query($queryData);
80
+        if (!empty($queryData)) {
81
+            $pathURI = $pathURI.'?'.http_build_query($queryData);
82 82
         }
83 83
 
84 84
         return $pathURI;
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
      * @param array $options
90 90
      * @return \Requests_Response
91 91
      */
92
-    public function get($path = '',$options = array()){
92
+    public function get($path = '', $options = array()) {
93 93
         $this->refreshToken();
94 94
 
95 95
         return Requests::get(
96
-            $this->mergeRequestPathURI($path,$options),$this->requestHeader,
96
+            $this->mergeRequestPathURI($path, $options), $this->requestHeader,
97 97
             $this->mergeRequestOptions($options)
98 98
         );
99 99
     }
100 100
 
101
-    public function getShallow($path = '',$options = array()){
101
+    public function getShallow($path = '', $options = array()) {
102 102
         $this->refreshToken();
103 103
 
104 104
         return Requests::get($this->getPathURI(
105
-            $path). '?' . http_build_query(array(JCFirebaseOption::OPTION_SHALLOW => JCFirebaseOption::SHALLOW_TRUE)),
105
+            $path).'?'.http_build_query(array(JCFirebaseOption::OPTION_SHALLOW => JCFirebaseOption::SHALLOW_TRUE)),
106 106
             $this->requestHeader,
107 107
             $this->mergeRequestOptions($options)
108 108
         );
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
      * @param array $options
114 114
      * @return \Requests_Response
115 115
      */
116
-    public function put($path = '',$options = array()){
116
+    public function put($path = '', $options = array()) {
117 117
         $this->refreshToken();
118 118
 
119
-        return Requests::put($this->getPathURI($path),$this->requestHeader,$this->mergeRequestOptions($options,true));
119
+        return Requests::put($this->getPathURI($path), $this->requestHeader, $this->mergeRequestOptions($options, true));
120 120
     }
121 121
 
122 122
     /**
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
      * @param array $options
125 125
      * @return \Requests_Response
126 126
      */
127
-    public function post($path = '',$options = array()){
127
+    public function post($path = '', $options = array()) {
128 128
         $this->refreshToken();
129 129
 
130
-        return Requests::post($this->getPathURI($path),$this->requestHeader,$this->mergeRequestOptions($options,true));
130
+        return Requests::post($this->getPathURI($path), $this->requestHeader, $this->mergeRequestOptions($options, true));
131 131
     }
132 132
 
133 133
     /**
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
      * @param array $options
136 136
      * @return \Requests_Response
137 137
      */
138
-    public function patch($path = '',$options = array()){
138
+    public function patch($path = '', $options = array()) {
139 139
         $this->refreshToken();
140 140
 
141
-        return Requests::patch($this->getPathURI($path),$this->requestHeader,$this->mergeRequestOptions($options,true));
141
+        return Requests::patch($this->getPathURI($path), $this->requestHeader, $this->mergeRequestOptions($options, true));
142 142
     }
143 143
 
144 144
     /**
@@ -146,37 +146,37 @@  discard block
 block discarded – undo
146 146
      * @param array $options
147 147
      * @return \Requests_Response
148 148
      */
149
-    public function delete($path = '',$options = array()){
149
+    public function delete($path = '', $options = array()) {
150 150
         $this->refreshToken();
151 151
 
152
-        return Requests::delete($this->getPathURI($path),$this->requestHeader,$this->mergeRequestOptions($options));
152
+        return Requests::delete($this->getPathURI($path), $this->requestHeader, $this->mergeRequestOptions($options));
153 153
     }
154 154
 
155
-    protected function mergeRequestOptions($options = array(),$jsonEncode = false){
155
+    protected function mergeRequestOptions($options = array(), $jsonEncode = false) {
156 156
         $requestOptions = array();
157 157
 
158
-        if(isset($options['data'])){
159
-            $requestOptions = array_merge($options['data'],$requestOptions);
158
+        if (isset($options['data'])) {
159
+            $requestOptions = array_merge($options['data'], $requestOptions);
160 160
         }
161 161
 
162
-        if($jsonEncode){
162
+        if ($jsonEncode) {
163 163
             $requestOptions = json_encode($requestOptions);
164 164
         }
165 165
 
166 166
         return $requestOptions;
167 167
     }
168 168
 
169
-    protected function mergeRequestPathURI($path='',$options = array(),$reqType = JCFirebaseOption::REQ_TYPE_GET){
169
+    protected function mergeRequestPathURI($path = '', $options = array(), $reqType = JCFirebaseOption::REQ_TYPE_GET) {
170 170
         $print = '';
171
-        if(isset($options['print'])){
172
-            if(JCFirebaseOption::isAllowPrint($reqType,$options['print'])){
171
+        if (isset($options['print'])) {
172
+            if (JCFirebaseOption::isAllowPrint($reqType, $options['print'])) {
173 173
                 $print = $options['print'];
174 174
             }
175 175
         }
176
-        return $this->getPathURI($path,$print);
176
+        return $this->getPathURI($path, $print);
177 177
     }
178 178
 
179
-    protected function refreshToken(){
180
-        $this->requestHeader['Authorization'] = 'Bearer '. $this->auth->getAccessToken();
179
+    protected function refreshToken() {
180
+        $this->requestHeader['Authorization'] = 'Bearer '.$this->auth->getAccessToken();
181 181
     }
182 182
 }
183 183
\ No newline at end of file
Please login to merge, or discard this patch.
src/OAuth.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,34 +24,34 @@  discard block
 block discarded – undo
24 24
      * @param $key
25 25
      * @param $iss
26 26
      */
27
-    public function __construct($key, $iss,$tokenLifeTime = 3600)
27
+    public function __construct($key, $iss, $tokenLifeTime = 3600)
28 28
     {
29 29
         $this->key = $key;
30 30
         $this->iss = $iss;
31 31
         $this->tokenLifeTime = 3600;
32 32
     }
33 33
 
34
-    public function getAccessToken(){
34
+    public function getAccessToken() {
35 35
         $accessToken = null;
36 36
 
37
-        if($this->exp <= time()){
37
+        if ($this->exp <= time()) {
38 38
             $sTime = time();
39 39
 
40 40
             $jsonToken = array(
41 41
                 "iss"=>$this->iss,
42 42
                 "scope"=>"https://www.googleapis.com/auth/firebase.database https://www.googleapis.com/auth/userinfo.email",
43 43
                 "aud"=>"https://www.googleapis.com/oauth2/v4/token",
44
-                "exp"=>time()+$this->tokenLifeTime,
44
+                "exp"=>time() + $this->tokenLifeTime,
45 45
                 "iat"=>time()
46 46
             );
47 47
             $jwt = JWT::encode($jsonToken, $this->key, 'RS256');
48 48
 
49
-            $OAuthResponse = Requests::post('https://www.googleapis.com/oauth2/v4/token',null,array(
49
+            $OAuthResponse = Requests::post('https://www.googleapis.com/oauth2/v4/token', null, array(
50 50
                 'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer',
51 51
                 'assertion' => $jwt
52 52
             ));
53 53
 
54
-            if($OAuthResponse->status_code == 200){
54
+            if ($OAuthResponse->status_code == 200) {
55 55
                 $accessToken = json_decode($OAuthResponse->body)->access_token;
56 56
                 $this->accessToken = $accessToken;
57 57
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 $this->exp = $sTime - $eTime + $this->tokenLifeTime;
61 61
             }
62 62
         }
63
-        else{
63
+        else {
64 64
             $accessToken = $this->accessToken;
65 65
         }
66 66
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@
 block discarded – undo
87 87
     public function get($path = '',$options = array()){
88 88
         if(isset($options['settings'])) {
89 89
             $requestOptions = array_merge($options['settings'],$this->requestOptions);
90
-        }
91
-        else{
90
+        } else{
92 91
             $requestOptions = $this->requestOptions;
93 92
         }
94 93
 
Please login to merge, or discard this patch.