Passed
Push — master ( 8005c7...9b803d )
by Goffy
03:14
created
index.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
     Github\GithubClient
29 29
 };
30 30
 
31
-require __DIR__ . '/header.php';
31
+require __DIR__.'/header.php';
32 32
 $GLOBALS['xoopsOption']['template_main'] = 'wggithub_index.tpl';
33
-include_once \XOOPS_ROOT_PATH . '/header.php';
33
+include_once \XOOPS_ROOT_PATH.'/header.php';
34 34
 
35 35
 // Permissions
36 36
 $permGlobalView = $permissionsHandler->getPermGlobalView();
37 37
 if (!$permGlobalView) {
38 38
     $GLOBALS['xoopsTpl']->assign('error', _NOPERM);
39
-    require __DIR__ . '/footer.php';
39
+    require __DIR__.'/footer.php';
40 40
 }
41 41
 $permGlobalRead   = $permissionsHandler->getPermGlobalRead();
42 42
 $permReadmeUpdate = $permissionsHandler->getPermReadmeUpdate();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 // Define Stylesheet
52 52
 $GLOBALS['xoTheme']->addStylesheet($style, null);
53
-$GLOBALS['xoTheme']->addStylesheet(WGGITHUB_URL . '/assets/css/tabs.css', null);
53
+$GLOBALS['xoTheme']->addStylesheet(WGGITHUB_URL.'/assets/css/tabs.css', null);
54 54
 $keywords = [];
55 55
 // 
56 56
 $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL);
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
             foreach (\array_keys($directoriesAll) as $i) {
121 121
                 $directories[$i] = $directoriesAll[$i]->getValuesDirectories();
122 122
                 $dirName = $directoriesAll[$i]->getVar('dir_name');
123
-                $dirFilterRelease = (bool)$directoriesAll[$i]->getVar('dir_filterrelease');
123
+                $dirFilterRelease = (bool) $directoriesAll[$i]->getVar('dir_filterrelease');
124 124
                 $repos = [];
125 125
                 $crRepositories = new \CriteriaCompo();
126 126
                 $crRepositories->add(new \Criteria('repo_user', $dirName));
127 127
                 $repositoriesCountTotal = $repositoriesHandler->getCount($crRepositories);
128 128
                 if ('any' === $filterRelease && $dirFilterRelease) {
129
-                    $crRepositories->add(new \Criteria('repo_prerelease', 1) );
129
+                    $crRepositories->add(new \Criteria('repo_prerelease', 1));
130 130
                     $crRepositories->add(new \Criteria('repo_release', 1), 'OR');
131 131
                 }
132 132
                 if ('final' === $filterRelease && $dirFilterRelease) {
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
                 }
182 182
                 $directories[$i]['repos'] = $repos;
183 183
                 $directories[$i]['previousRepos'] = $start > 0;
184
-                $directories[$i]['previousOp'] = '&start=' . ($start - $limit) . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
184
+                $directories[$i]['previousOp'] = '&start='.($start - $limit).'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
185 185
                 $directories[$i]['nextRepos'] = ($repositoriesCount - $start) > $limit;
186
-                $directories[$i]['nextOp'] = '&start=' . ($start + $limit) . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
186
+                $directories[$i]['nextOp'] = '&start='.($start + $limit).'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
187 187
                 $GLOBALS['xoopsTpl']->assign('start', $start);
188 188
                 $GLOBALS['xoopsTpl']->assign('limit', $limit);
189 189
                 $GLOBALS['xoopsTpl']->assign('menu', $menu);
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
             unset($crDirectories, $directories);
195 195
             // Display Navigation
196 196
             if ($directoriesCount > $limit) {
197
-                require_once \XOOPS_ROOT_PATH . '/class/pagenav.php';
198
-                $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
197
+                require_once \XOOPS_ROOT_PATH.'/class/pagenav.php';
198
+                $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit);
199 199
                 $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
200 200
             }
201 201
             $GLOBALS['xoopsTpl']->assign('lang_thereare', \sprintf(\_MA_WGGITHUB_INDEX_THEREARE, $directoriesCount));
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
         // Permissions
209 209
         if (!$permGlobalRead) {
210 210
             $GLOBALS['xoopsTpl']->assign('error', \_NOPERM);
211
-            require __DIR__ . '/footer.php';
211
+            require __DIR__.'/footer.php';
212 212
         }
213 213
         $dirName = Request::getString('dir_name', '');
214 214
         $result = executeUpdate($dirName);
215
-        $redir = 'index.php?op=list_afterupdate&start=' . $start . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
215
+        $redir = 'index.php?op=list_afterupdate&start='.$start.'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
216 216
         if ($result) {
217 217
             \redirect_header($redir, 2, \_MA_WGGITHUB_READGH_SUCCESS);
218 218
         } else {
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
         // Permissions
225 225
         if (!$permReadmeUpdate) {
226 226
             $GLOBALS['xoopsTpl']->assign('error', \_NOPERM);
227
-            require __DIR__ . '/footer.php';
227
+            require __DIR__.'/footer.php';
228 228
         }
229 229
         $repoId = Request::getInt('repo_id', 0);
230 230
         $repoUser  = Request::getString('repo_user', 'none');
231 231
         $repoName  = Request::getString('repo_name', 'none');
232 232
         $result = $helper->getHandler('Readmes')->updateReadmes($repoId, $repoUser, $repoName);
233
-        $redir = 'index.php?op=list_afterupdate&start=' . $start . '&limit=' . $limit . '&release=' . $filterRelease . '&sortby=' . $filterSortby;
233
+        $redir = 'index.php?op=list_afterupdate&start='.$start.'&limit='.$limit.'&release='.$filterRelease.'&sortby='.$filterSortby;
234 234
         if ($result) {
235 235
             \redirect_header($redir, 2, \_MA_WGGITHUB_READGH_SUCCESS);
236 236
         } else {
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 // Breadcrumbs
244 244
 $xoBreadcrumbs[] = ['title' => \_MA_WGGITHUB_INDEX];
245 245
 // Keywords
246
-wggithubMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords));
246
+wggithubMetaKeywords($helper->getConfig('keywords').', '.\implode(',', $keywords));
247 247
 unset($keywords);
248 248
 // Description
249 249
 wggithubMetaDescription(\_MA_WGGITHUB_INDEX_DESC);
250 250
 $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', WGGITHUB_URL.'/index.php');
251 251
 $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL);
252 252
 $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL);
253
-require __DIR__ . '/footer.php';
253
+require __DIR__.'/footer.php';
254 254
 
255 255
 
256 256
 /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $dirName
259 259
  * @return bool
260 260
  */
261
-function executeUpdate($dirName = ''){
261
+function executeUpdate($dirName = '') {
262 262
 
263 263
     $githubClient = GithubClient::getInstance();
264 264
     $helper = Helper::getInstance();
Please login to merge, or discard this patch.
admin/github-api.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,52 +30,52 @@  discard block
 block discarded – undo
30 30
 use XoopsModules\Wggithub;
31 31
 use XoopsModules\Wggithub\Github;
32 32
 
33
-require __DIR__ . '/header.php';
33
+require __DIR__.'/header.php';
34 34
 // It recovered the value of argument op in URL$
35 35
 
36 36
 
37 37
 $data = [];
38 38
 $url = '/orgs/XoopsModules25x/repos?per_page=100&page=1';
39
-echo "<br>Test read org repo:" . $url;
39
+echo "<br>Test read org repo:".$url;
40 40
 $api = new XoopsModules\Wggithub\Github\GithubClient();
41 41
 $data = $api->testMilo($url);
42 42
 $count = 0;
43 43
 foreach ($data as $key => $repo) {
44
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
44
+    echo "<br>key:".$key.' repo:'.$repo['name'];
45 45
     $count++;
46
-    if ($count>5) {break;}
46
+    if ($count > 5) {break; }
47 47
 }
48 48
 
49 49
 
50 50
 $data = [];
51 51
 $url = '/users/ggoffy/repos?per_page=100&page=1';
52
-echo "<br><br>Test read user repo:" . $url;
52
+echo "<br><br>Test read user repo:".$url;
53 53
 $api = new XoopsModules\Wggithub\Github\GithubClient();
54 54
 $data = $api->testMilo($url);
55 55
 $count = 0;
56 56
 foreach ($data as $key => $repo) {
57
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
57
+    echo "<br>key:".$key.' repo:'.$repo['name'];
58 58
     $count++;
59
-    if ($count>5) {break;}
59
+    if ($count > 5) {break; }
60 60
 }
61 61
 
62 62
 
63 63
 $data = [];
64 64
 $url = '/repos/XoopsModules25x/smallworld/readme';
65
-echo "<br><br>test read readme orgs:" . $url;
65
+echo "<br><br>test read readme orgs:".$url;
66 66
 $api = new XoopsModules\Wggithub\Github\GithubClient();
67 67
 $data = $api->testMilo($url);
68
-echo '<br>name:' . $data['name'];
69
-echo '<br>download_url:' . $data['download_url'];
68
+echo '<br>name:'.$data['name'];
69
+echo '<br>download_url:'.$data['download_url'];
70 70
 
71 71
 
72 72
 $data = [];
73 73
 $url = '/repos/ggoffy/wggithub/readme';
74
-echo "<br><br>test read readme user:" . $url;
74
+echo "<br><br>test read readme user:".$url;
75 75
 $api = new XoopsModules\Wggithub\Github\GithubClient();
76 76
 $data = $api->testMilo($url);
77
-echo '<br>name:' . $data['name'];
78
-echo '<br>download_url:' . $data['download_url'];
77
+echo '<br>name:'.$data['name'];
78
+echo '<br>download_url:'.$data['download_url'];
79 79
 
80 80
 
81 81
 echo "<br><br><br>-----------------------------------";
@@ -84,45 +84,45 @@  discard block
 block discarded – undo
84 84
 
85 85
 $data = [];
86 86
 $url = '/orgs/XoopsModules25x/repos?per_page=100&page=1';
87
-echo "<br>Test read org repo:" . $url;
87
+echo "<br>Test read org repo:".$url;
88 88
 $api = new XoopsModules\Wggithub\Github\GithubClient();
89 89
 $data = $api->testMilo2($url);
90 90
 $count = 0;
91 91
 foreach ($data as $key => $repo) {
92
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
92
+    echo "<br>key:".$key.' repo:'.$repo['name'];
93 93
     $count++;
94
-    if ($count>5) {break;}
94
+    if ($count > 5) {break; }
95 95
 }
96 96
 
97 97
 
98 98
 $data = [];
99 99
 $url = '/users/ggoffy/repos?per_page=100&page=1';
100
-echo "<br><br>Test read user repo:" . $url;
100
+echo "<br><br>Test read user repo:".$url;
101 101
 $api = new XoopsModules\Wggithub\Github\GithubClient();
102 102
 $data = $api->testMilo2($url);
103 103
 $count = 0;
104 104
 foreach ($data as $key => $repo) {
105
-    echo "<br>key:" . $key . ' repo:' . $repo['name'];
105
+    echo "<br>key:".$key.' repo:'.$repo['name'];
106 106
     $count++;
107
-    if ($count>5) {break;}
107
+    if ($count > 5) {break; }
108 108
 }
109 109
 
110 110
 
111 111
 $data = [];
112 112
 $url = '/repos/XoopsModules25x/smallworld/readme';
113
-echo "<br><br>test read readme orgs:" . $url;
113
+echo "<br><br>test read readme orgs:".$url;
114 114
 $api = new XoopsModules\Wggithub\Github\GithubClient();
115 115
 $data = $api->testMilo2($url);
116
-echo '<br>name:' . $data['name'];
117
-echo '<br>download_url:' . $data['download_url'];
116
+echo '<br>name:'.$data['name'];
117
+echo '<br>download_url:'.$data['download_url'];
118 118
 
119 119
 
120 120
 $data = [];
121 121
 $url = '/repos/ggoffy/wggithub/readme';
122
-echo "<br><br>test read readme user:" . $url;
122
+echo "<br><br>test read readme user:".$url;
123 123
 $api = new XoopsModules\Wggithub\Github\GithubClient();
124 124
 $data = $api->testMilo2($url);
125
-echo '<br>name:' . $data['name'];
126
-echo '<br>download_url:' . $data['download_url'];
125
+echo '<br>name:'.$data['name'];
126
+echo '<br>download_url:'.$data['download_url'];
127 127
 
128 128
 
Please login to merge, or discard this patch.
class/Github/GithubClient.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     public function testMilo($url) {
83 83
         $api = new Github\Api;
84
-        $response = $api->get(static::BASE_URL . $url);
84
+        $response = $api->get(static::BASE_URL.$url);
85 85
         $data = $api->decode($response);
86 86
         
87 87
         return $data;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         $token = new Github\OAuth\Token('{myKey}', 'bearer', ['repo', 'user', 'public_repo']);
94 94
         $api->setToken($token);
95
-        $response = $api->get(static::BASE_URL . $url);
95
+        $response = $api->get(static::BASE_URL.$url);
96 96
 
97 97
         $data = $api->decode($response);
98 98
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getUserRepositories($username, $per_page = 100, $page = 1)
119 119
     {
120
-        $url = static::BASE_URL . 'users/' . \rawurlencode($username) . '/repos?per_page=' . $per_page . '&page=' . $page;
120
+        $url = static::BASE_URL.'users/'.\rawurlencode($username).'/repos?per_page='.$per_page.'&page='.$page;
121 121
 
122 122
         return $this->_get($url);
123 123
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getOrgRepositories($org, $per_page = 100, $page = 1)
134 134
     {
135
-        $url = static::BASE_URL . 'orgs/' . \rawurlencode($org) . '/repos?per_page=' . $per_page . '&page=' . $page;
135
+        $url = static::BASE_URL.'orgs/'.\rawurlencode($org).'/repos?per_page='.$per_page.'&page='.$page;
136 136
 
137 137
         return $this->_get($url);
138 138
     }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getReadme($username, $repository)
148 148
     {
149
-        $url = static::BASE_URL . 'repos/' . \rawurlencode($username) . '/' . \rawurlencode($repository) . '/readme';
149
+        $url = static::BASE_URL.'repos/'.\rawurlencode($username).'/'.\rawurlencode($repository).'/readme';
150 150
 
151 151
         return $this->_get($url);
152 152
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function getReleases($username, $repository)
162 162
     {
163
-        $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases';
163
+        $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases';
164 164
 
165 165
         return $this->_get($url);
166 166
     }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
     public function getLatestRelease($username, $repository, $prerelease = false)
177 177
     {
178 178
         if ($prerelease) {
179
-            $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases';
179
+            $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases';
180 180
         } else {
181
-            $url = static::BASE_URL . 'repos/' . $username . '/' . $repository . '/releases/latest';
181
+            $url = static::BASE_URL.'repos/'.$username.'/'.$repository.'/releases/latest';
182 182
         }
183 183
         $result = $this->_get($url);
184 184
 
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
         } else {
217 217
             $error = true;
218 218
             $errMsg = $response->getContent();
219
-            $logsHandler->updateTableLogs(Constants::LOG_TYPE_ERROR, $errMsg, 'ERROR ' . $code);
219
+            $logsHandler->updateTableLogs(Constants::LOG_TYPE_ERROR, $errMsg, 'ERROR '.$code);
220 220
         }
221 221
         if ($error) {
222 222
             //catch common errors
223 223
             switch ($code) {
224 224
                 case 401:
225
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_401 . '"');
225
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_401.'"');
226 226
                     break;
227 227
                 case 403:
228 228
                     /*
@@ -230,21 +230,21 @@  discard block
 block discarded – undo
230 230
                         $GLOBALS['xoopsTpl']->assign('apiexceed', true);
231 231
                     }
232 232
                     */
233
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_403 . '"');
233
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_403.'"');
234 234
                     break;
235 235
                 case 404:
236
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_404 . '"');
236
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_404.'"');
237 237
                     break;
238 238
                 case 405:
239
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API_405 . '"');
239
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API_405.'"');
240 240
                     break;
241 241
                 case 0:
242 242
                 default:
243
-                    throw new \RuntimeException('"' . \_MA_WGGITHUB_READGH_ERROR_API . $errMsg . '"');
243
+                    throw new \RuntimeException('"'.\_MA_WGGITHUB_READGH_ERROR_API.$errMsg.'"');
244 244
                     break;
245 245
             }
246 246
         }
247
-        $data = (array)$api->decode($response);
247
+        $data = (array) $api->decode($response);
248 248
 
249 249
         return $data;
250 250
     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $setting = $settingsHandler->getPrimarySetting();
261 261
 
262 262
         if (0 == \count($setting)) {
263
-            \redirect_header(\XOOPS_URL . '/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS);
263
+            \redirect_header(\XOOPS_URL.'/index.php', 3, \_AM_WGGITHUB_THEREARENT_SETTINGS);
264 264
         }
265 265
         //$this->userAuth = $setting['user'];
266 266
         $this->tokenAuth = $setting['token'];
Please login to merge, or discard this patch.
class/Github/exceptions.php 1 patch
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -8,169 +8,169 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 namespace XoopsModules\Wggithub\Github {
11
-	/**
12
-	 * Marker interface.
13
-	 */
14
-	interface IException
15
-	{}
11
+    /**
12
+     * Marker interface.
13
+     */
14
+    interface IException
15
+    {}
16 16
 
17 17
 
18
-	/**
19
-	 * Wrong algorithm. API is used in wrong way. Application code should be changed.
20
-	 */
21
-	class LogicException extends \LogicException implements IException
22
-	{}
18
+    /**
19
+     * Wrong algorithm. API is used in wrong way. Application code should be changed.
20
+     */
21
+    class LogicException extends \LogicException implements IException
22
+    {}
23 23
 
24 24
 
25
-	/**
26
-	 * Substitution is used in URL path but corresponding parameter is missing.
27
-	 */
28
-	class MissingParameterException extends LogicException
29
-	{}
25
+    /**
26
+     * Substitution is used in URL path but corresponding parameter is missing.
27
+     */
28
+    class MissingParameterException extends LogicException
29
+    {}
30 30
 
31 31
 
32
-	/**
33
-	 * Unpredictable situation occurred.
34
-	 */
35
-	abstract class RuntimeException extends \RuntimeException implements IException
36
-	{}
32
+    /**
33
+     * Unpredictable situation occurred.
34
+     */
35
+    abstract class RuntimeException extends \RuntimeException implements IException
36
+    {}
37 37
 
38 38
 
39
-	/**
40
-	 * Github API returned a non-success HTTP code or data are somehow wrong. See all following descendants.
41
-	 *
42
-	 * @see Api::decode()
43
-	 * @see https://developer.github.com/v3/#client-errors
44
-	 */
45
-	abstract class ApiException extends RuntimeException
46
-	{
47
-		/** @var Http\Response|NULL */
48
-		private $response;
39
+    /**
40
+     * Github API returned a non-success HTTP code or data are somehow wrong. See all following descendants.
41
+     *
42
+     * @see Api::decode()
43
+     * @see https://developer.github.com/v3/#client-errors
44
+     */
45
+    abstract class ApiException extends RuntimeException
46
+    {
47
+        /** @var Http\Response|NULL */
48
+        private $response;
49 49
 
50 50
 
51
-		/**
52
-		 * @param string
53
-		 * @param int
54
-		 */
55
-		public function __construct($message = '', $code = 0, \Exception $previous = NULL, Http\Response $response = NULL)
56
-		{
57
-			parent::__construct($message, $code, $previous);
58
-			$this->response = clone $response;
59
-		}
51
+        /**
52
+         * @param string
53
+         * @param int
54
+         */
55
+        public function __construct($message = '', $code = 0, \Exception $previous = NULL, Http\Response $response = NULL)
56
+        {
57
+            parent::__construct($message, $code, $previous);
58
+            $this->response = clone $response;
59
+        }
60 60
 
61 61
 
62
-		/**
63
-		 * @return Http\Response|NULL
64
-		 */
65
-		final public function getResponse()
66
-		{
67
-			return $this->response;
68
-		}
62
+        /**
63
+         * @return Http\Response|NULL
64
+         */
65
+        final public function getResponse()
66
+        {
67
+            return $this->response;
68
+        }
69 69
 
70
-	}
70
+    }
71 71
 
72 72
 
73
-	/**
74
-	 * Invalid credentials (e.g. revoked token).
75
-	 */
76
-	class UnauthorizedException extends ApiException
77
-	{}
73
+    /**
74
+     * Invalid credentials (e.g. revoked token).
75
+     */
76
+    class UnauthorizedException extends ApiException
77
+    {}
78 78
 
79 79
 
80
-	/**
81
-	 * Invalid JSON sent to Github API.
82
-	 */
83
-	class BadRequestException extends ApiException
84
-	{}
80
+    /**
81
+     * Invalid JSON sent to Github API.
82
+     */
83
+    class BadRequestException extends ApiException
84
+    {}
85 85
 
86 86
 
87
-	/**
88
-	 * Invalid structure sent to Github API (e.g. some required fields are missing).
89
-	 */
90
-	class UnprocessableEntityException extends ApiException
91
-	{}
87
+    /**
88
+     * Invalid structure sent to Github API (e.g. some required fields are missing).
89
+     */
90
+    class UnprocessableEntityException extends ApiException
91
+    {}
92 92
 
93 93
 
94
-	/**
95
-	 * Access denied.
96
-	 * @see https://developer.github.com/v3/#authentication
97
-	 */
98
-	class ForbiddenException extends ApiException
99
-	{}
94
+    /**
95
+     * Access denied.
96
+     * @see https://developer.github.com/v3/#authentication
97
+     */
98
+    class ForbiddenException extends ApiException
99
+    {}
100 100
 
101 101
 
102
-	/**
103
-	 * Rate limit exceed.
104
-	 * @see https://developer.github.com/v3/#rate-limiting
105
-	 */
106
-	class RateLimitExceedException extends ForbiddenException
107
-	{}
102
+    /**
103
+     * Rate limit exceed.
104
+     * @see https://developer.github.com/v3/#rate-limiting
105
+     */
106
+    class RateLimitExceedException extends ForbiddenException
107
+    {}
108 108
 
109 109
 
110
-	/**
111
-	 * Resource not found.
112
-	 * @see https://developer.github.com/v3/#authentication
113
-	 */
114
-	class NotFoundException extends ApiException
115
-	{}
110
+    /**
111
+     * Resource not found.
112
+     * @see https://developer.github.com/v3/#authentication
113
+     */
114
+    class NotFoundException extends ApiException
115
+    {}
116 116
 
117 117
 
118
-	/**
119
-	 * Response cannot be classified.
120
-	 */
121
-	class UnexpectedResponseException extends ApiException
122
-	{}
118
+    /**
119
+     * Response cannot be classified.
120
+     */
121
+    class UnexpectedResponseException extends ApiException
122
+    {}
123 123
 
124 124
 
125
-	/**
126
-	 * Response from Github is somehow wrong (e.g. invalid JSON decoding).
127
-	 */
128
-	class InvalidResponseException extends ApiException
129
-	{}
125
+    /**
126
+     * Response from Github is somehow wrong (e.g. invalid JSON decoding).
127
+     */
128
+    class InvalidResponseException extends ApiException
129
+    {}
130 130
 
131 131
 
132
-	/**
133
-	 * JSON cannot be decoded, or value cannot be encoded to JSON.
134
-	 */
135
-	class JsonException extends RuntimeException
136
-	{
137
-	}
132
+    /**
133
+     * JSON cannot be decoded, or value cannot be encoded to JSON.
134
+     */
135
+    class JsonException extends RuntimeException
136
+    {
137
+    }
138 138
 
139 139
 }
140 140
 
141 141
 
142 142
 namespace Milo\Github\Http {
143
-	use Milo\Github;
143
+    use Milo\Github;
144 144
 
145 145
 
146
-	/**
147
-	 * HTTP response is somehow wrong and cannot be processed.
148
-	 */
149
-	class BadResponseException extends Github\RuntimeException
150
-	{}
146
+    /**
147
+     * HTTP response is somehow wrong and cannot be processed.
148
+     */
149
+    class BadResponseException extends Github\RuntimeException
150
+    {}
151 151
 
152 152
 }
153 153
 
154 154
 
155 155
 namespace Milo\Github\OAuth {
156
-	use Milo\Github;
156
+    use Milo\Github;
157 157
 
158
-	/**
159
-	 * Something fails during the token obtaining.
160
-	 */
161
-	class LoginException extends Github\RuntimeException
162
-	{}
158
+    /**
159
+     * Something fails during the token obtaining.
160
+     */
161
+    class LoginException extends Github\RuntimeException
162
+    {}
163 163
 
164 164
 }
165 165
 
166 166
 
167 167
 namespace Milo\Github\Storages {
168
-	use Milo\Github;
168
+    use Milo\Github;
169 169
 
170
-	/**
171
-	 * Directory is missing and/or cannot be created.
172
-	 */
173
-	class MissingDirectoryException extends Github\RuntimeException
174
-	{}
170
+    /**
171
+     * Directory is missing and/or cannot be created.
172
+     */
173
+    class MissingDirectoryException extends Github\RuntimeException
174
+    {}
175 175
 
176 176
 }
Please login to merge, or discard this patch.
class/Logs.php 1 patch
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -32,61 +32,61 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class Logs extends \XoopsObject
34 34
 {
35
-	/**
36
-	 * Constructor
37
-	 *
38
-	 * @param null
39
-	 */
40
-	public function __construct()
41
-	{
42
-		$this->initVar('log_id', XOBJ_DTYPE_INT);
35
+    /**
36
+     * Constructor
37
+     *
38
+     * @param null
39
+     */
40
+    public function __construct()
41
+    {
42
+        $this->initVar('log_id', XOBJ_DTYPE_INT);
43 43
         $this->initVar('log_type', XOBJ_DTYPE_INT);
44
-		$this->initVar('log_details', XOBJ_DTYPE_TXTBOX);
45
-		$this->initVar('log_result', XOBJ_DTYPE_TXTAREA);
46
-		$this->initVar('log_datecreated', XOBJ_DTYPE_INT);
47
-		$this->initVar('log_submitter', XOBJ_DTYPE_INT);
48
-	}
44
+        $this->initVar('log_details', XOBJ_DTYPE_TXTBOX);
45
+        $this->initVar('log_result', XOBJ_DTYPE_TXTAREA);
46
+        $this->initVar('log_datecreated', XOBJ_DTYPE_INT);
47
+        $this->initVar('log_submitter', XOBJ_DTYPE_INT);
48
+    }
49 49
 
50
-	/**
51
-	 * @static function &getInstance
52
-	 *
53
-	 * @param null
54
-	 */
55
-	public static function getInstance()
56
-	{
57
-		static $instance = false;
58
-		if (!$instance) {
59
-			$instance = new self();
60
-		}
61
-	}
50
+    /**
51
+     * @static function &getInstance
52
+     *
53
+     * @param null
54
+     */
55
+    public static function getInstance()
56
+    {
57
+        static $instance = false;
58
+        if (!$instance) {
59
+            $instance = new self();
60
+        }
61
+    }
62 62
 
63
-	/**
64
-	 * The new inserted $Id
65
-	 * @return inserted id
66
-	 */
67
-	public function getNewInsertedIdLogs()
68
-	{
69
-		$newInsertedId = $GLOBALS['xoopsDB']->getInsertId();
70
-		return $newInsertedId;
71
-	}
63
+    /**
64
+     * The new inserted $Id
65
+     * @return inserted id
66
+     */
67
+    public function getNewInsertedIdLogs()
68
+    {
69
+        $newInsertedId = $GLOBALS['xoopsDB']->getInsertId();
70
+        return $newInsertedId;
71
+    }
72 72
 
73
-	/**
74
-	 * @public function getForm
75
-	 * @param bool $action
76
-	 * @return \XoopsThemeForm
77
-	 */
78
-	public function getFormLogs($action = false)
79
-	{
80
-		$helper = \XoopsModules\Wggithub\Helper::getInstance();
81
-		if (!$action) {
82
-			$action = $_SERVER['REQUEST_URI'];
83
-		}
84
-		// Title
85
-		$title = $this->isNew() ? \sprintf(_AM_WGGITHUB_LOG_ADD) : \sprintf(_AM_WGGITHUB_LOG_EDIT);
86
-		// Get Theme Form
87
-		\xoops_load('XoopsFormLoader');
88
-		$form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
89
-		$form->setExtra('enctype="multipart/form-data"');
73
+    /**
74
+     * @public function getForm
75
+     * @param bool $action
76
+     * @return \XoopsThemeForm
77
+     */
78
+    public function getFormLogs($action = false)
79
+    {
80
+        $helper = \XoopsModules\Wggithub\Helper::getInstance();
81
+        if (!$action) {
82
+            $action = $_SERVER['REQUEST_URI'];
83
+        }
84
+        // Title
85
+        $title = $this->isNew() ? \sprintf(_AM_WGGITHUB_LOG_ADD) : \sprintf(_AM_WGGITHUB_LOG_EDIT);
86
+        // Get Theme Form
87
+        \xoops_load('XoopsFormLoader');
88
+        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
89
+        $form->setExtra('enctype="multipart/form-data"');
90 90
 
91 91
         $logTypeSelect = new \XoopsFormSelect(_AM_WGGITHUB_LOG_TYPE, 'log_type', $this->getVar('log_type'));
92 92
         $logTypeSelect->addOption(Constants::LOG_TYPE_NONE, _AM_WGGITHUB_LOG_TYPE_NONE);
@@ -95,35 +95,35 @@  discard block
 block discarded – undo
95 95
         $logTypeSelect->addOption(Constants::LOG_TYPE_REQUEST, _AM_WGGITHUB_LOG_TYPE_REQUEST);
96 96
         $logTypeSelect->addOption(Constants::LOG_TYPE_ERROR, _AM_WGGITHUB_LOG_TYPE_ERROR);
97 97
         $form->addElement($logTypeSelect);
98
-		// Form Text logDetails
99
-		$form->addElement(new \XoopsFormText(_AM_WGGITHUB_LOG_DETAILS, 'log_details', 50, 255, $this->getVar('log_details')), true);
100
-		// Form Text logResult
98
+        // Form Text logDetails
99
+        $form->addElement(new \XoopsFormText(_AM_WGGITHUB_LOG_DETAILS, 'log_details', 50, 255, $this->getVar('log_details')), true);
100
+        // Form Text logResult
101 101
         $form->addElement(new \XoopsFormTextArea(_AM_WGGITHUB_LOG_RESULT, 'log_result', $this->getVar('log_result', 'e'), 4, 47));
102
-		// Form Text Date Select logDatecreated
103
-		$logDatecreated = $this->isNew() ?: $this->getVar('log_datecreated');
104
-		$form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_LOG_DATECREATED, 'log_datecreated', '', $logDatecreated));
105
-		// Form Select User reqSubmitter
106
-		$form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_LOG_SUBMITTER, 'log_submitter', false, $this->getVar('log_submitter')));
107
-		// To Save
108
-		$form->addElement(new \XoopsFormHidden('op', 'save'));
109
-		$form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
110
-		return $form;
111
-	}
102
+        // Form Text Date Select logDatecreated
103
+        $logDatecreated = $this->isNew() ?: $this->getVar('log_datecreated');
104
+        $form->addElement(new \XoopsFormTextDateSelect(_AM_WGGITHUB_LOG_DATECREATED, 'log_datecreated', '', $logDatecreated));
105
+        // Form Select User reqSubmitter
106
+        $form->addElement(new \XoopsFormSelectUser(_AM_WGGITHUB_LOG_SUBMITTER, 'log_submitter', false, $this->getVar('log_submitter')));
107
+        // To Save
108
+        $form->addElement(new \XoopsFormHidden('op', 'save'));
109
+        $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
110
+        return $form;
111
+    }
112 112
 
113
-	/**
114
-	 * Get Values
115
-	 * @param null $keys
116
-	 * @param null $format
117
-	 * @param null $maxDepth
118
-	 * @return array
119
-	 */
120
-	public function getValuesLogs($keys = null, $format = null, $maxDepth = null)
121
-	{
113
+    /**
114
+     * Get Values
115
+     * @param null $keys
116
+     * @param null $format
117
+     * @param null $maxDepth
118
+     * @return array
119
+     */
120
+    public function getValuesLogs($keys = null, $format = null, $maxDepth = null)
121
+    {
122 122
         $helper  = \XoopsModules\Wggithub\Helper::getInstance();
123 123
         $utility = new \XoopsModules\Wggithub\Utility();
124 124
         $editorMaxchar = $helper->getConfig('editor_maxchar');
125
-	    $ret = $this->getValues($keys, $format, $maxDepth);
126
-		$ret['id']           = $this->getVar('log_id');
125
+        $ret = $this->getValues($keys, $format, $maxDepth);
126
+        $ret['id']           = $this->getVar('log_id');
127 127
         $ret['type']         = $this->getVar('log_type');
128 128
         switch ($ret['type']) {
129 129
             case Constants::LOG_TYPE_NONE:
@@ -144,26 +144,26 @@  discard block
 block discarded – undo
144 144
                 break;
145 145
         }
146 146
         $ret['type_text']    = $type_text;
147
-		$ret['details']      = $this->getVar('log_details');
147
+        $ret['details']      = $this->getVar('log_details');
148 148
         $ret['result']       = \strip_tags($this->getVar('log_result', 'e'));
149 149
         $ret['result_short'] = $utility::truncateHtml($ret['result'], $editorMaxchar);
150
-		$ret['datecreated']  = \formatTimestamp($this->getVar('log_datecreated'), 'm');
151
-		$ret['submitter']    = \XoopsUser::getUnameFromId($this->getVar('log_submitter'));
152
-		return $ret;
153
-	}
150
+        $ret['datecreated']  = \formatTimestamp($this->getVar('log_datecreated'), 'm');
151
+        $ret['submitter']    = \XoopsUser::getUnameFromId($this->getVar('log_submitter'));
152
+        return $ret;
153
+    }
154 154
 
155
-	/**
156
-	 * Returns an array representation of the object
157
-	 *
158
-	 * @return array
159
-	 */
160
-	public function toArrayRequests()
161
-	{
162
-		$ret = [];
163
-		$vars = $this->getVars();
164
-		foreach (\array_keys($vars) as $var) {
165
-			$ret[$var] = $this->getVar('"{$var}"');
166
-		}
167
-		return $ret;
168
-	}
155
+    /**
156
+     * Returns an array representation of the object
157
+     *
158
+     * @return array
159
+     */
160
+    public function toArrayRequests()
161
+    {
162
+        $ret = [];
163
+        $vars = $this->getVars();
164
+        foreach (\array_keys($vars) as $var) {
165
+            $ret[$var] = $this->getVar('"{$var}"');
166
+        }
167
+        return $ret;
168
+    }
169 169
 }
Please login to merge, or discard this patch.
test.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
     Github\GithubClient
29 29
 };
30 30
 
31
-require __DIR__ . '/header.php';
31
+require __DIR__.'/header.php';
32 32
 $GLOBALS['xoopsOption']['template_main'] = 'wggithub_index.tpl';
33
-include_once \XOOPS_ROOT_PATH . '/header.php';
33
+include_once \XOOPS_ROOT_PATH.'/header.php';
34 34
 // Define Stylesheet
35 35
 $GLOBALS['xoTheme']->addStylesheet($style, null);
36 36
 $keywords = [];
@@ -166,4 +166,4 @@  discard block
 block discarded – undo
166 166
 var_dump($result);
167 167
 */
168 168
 
169
-require __DIR__ . '/footer.php';
169
+require __DIR__.'/footer.php';
Please login to merge, or discard this patch.