Passed
Pull Request — master (#1)
by Michael
02:10
created
syntax.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
      * @throws Exception
63 63
      */
64 64
     public function handle($match, $state, $pos, Doku_Handler $handler) {
65
-        list($pmServiceKey,$issueSyntax) = explode('>', trim($match,'[]'));
65
+        list($pmServiceKey, $issueSyntax) = explode('>', trim($match, '[]'));
66 66
 
67 67
         /** @var ServiceInterface $serviceClass */
68 68
         $serviceClass = $this->syntaxPatterns[$pmServiceKey]::getInstance();
69 69
 
70 70
         $issue = $serviceClass->parseIssueSyntax($issueSyntax);
71 71
 
72
-        if(null === $issue) {
72
+        if (null === $issue) {
73 73
             return [$pmServiceKey, $issueSyntax];
74 74
         }
75 75
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @return bool If rendering was successful.
97 97
      */
98 98
     public function render($mode, Doku_Renderer $renderer, $data) {
99
-        if($mode !== 'xhtml' || count($data) === 2) {
99
+        if ($mode !== 'xhtml' || count($data) === 2) {
100 100
             $renderer->interwikilink(null, null, 'google.com', implode(' ', $data));
101 101
             return true;
102 102
         }
Please login to merge, or discard this patch.
action/ajax.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $html = '<div class="org_repos">';
133 133
         $html .= '<p>Below are the repositories of the organisation to which the authorized user has access to. Click on the icon to create/delete the webhook.</p>';
134 134
         $html .= '<div><ul>';
135
-        usort($repos, function ($repo1, $repo2) {return $repo1->displayName < $repo2->displayName ? -1 : 1;});
135
+        usort($repos, function($repo1, $repo2) {return $repo1->displayName < $repo2->displayName ? -1 : 1; });
136 136
         foreach ($repos as $repo) {
137 137
             $stateIssue = empty($repo->hookID) ? 'inactive' : 'active';
138 138
             if ($repo->error === 403) {
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 
177 177
 
178 178
         ignore_user_abort(true);
179
-        set_time_limit(60*20);
179
+        set_time_limit(60 * 20);
180 180
         ob_start();
181 181
         $this->util->sendResponse(202, 'Importing  issues...');
182 182
         header('Connection: close');
183
-        header('Content-Length: '.ob_get_length());
183
+        header('Content-Length: ' . ob_get_length());
184 184
         ob_end_flush();
185 185
         ob_end_flush();
186 186
         flush();
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         $lockID = $data->getImportLockID($serviceName, $projectKey);
280 280
         $lockData = $data->getLockContent($lockID);
281 281
         if ($lockData === false) {
282
-            msg('Import not locked ' . $lockID,2);
282
+            msg('Import not locked ' . $lockID, 2);
283 283
             return [200, ['status' => 'done']];
284 284
         }
285 285
         if (!empty($lockData['status']) && $lockData['status'] === 'done') {
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
     protected function abortIssueImport() {
293 293
         if (!auth_ismanager()) {
294
-            return array(403,'');
294
+            return array(403, '');
295 295
         }
296 296
         /** @var helper_plugin_magicmatcher_data $data */
297 297
         $data = plugin_load('helper', 'magicmatcher_data');
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
     protected function abortCommitImport() {
309 309
         if (!auth_ismanager()) {
310
-            return array(403,'');
310
+            return array(403, '');
311 311
         }
312 312
         /** @var helper_plugin_magicmatcher_data $data */
313 313
         $data = plugin_load('helper', 'magicmatcher_data');
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             $option .= '>';
361 361
             $option .= $issue_option['label'];
362 362
             $option .= '</option>';
363
-            $options.= $option;
363
+            $options .= $option;
364 364
         }
365 365
         return array(200, array('issue_options' => $options));
366 366
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
  * @author  Michael Große <[email protected]>
7 7
  */
8 8
 
9
-if (!defined('DOKU_INC')) die();
9
+if (!defined('DOKU_INC')) {
10
+    die();
11
+}
10 12
 
11 13
 use dokuwiki\plugin\issuelinks\classes\Issue;
12 14
 use dokuwiki\plugin\issuelinks\classes\ServiceProvider;
@@ -200,7 +202,9 @@  discard block
 block discarded – undo
200 202
      * @return void
201 203
      */
202 204
     public function handle_ajax(Doku_Event $event, $param) {
203
-        if ($event->data !== 'plugin_issuelinks') return;
205
+        if ($event->data !== 'plugin_issuelinks') {
206
+            return;
207
+        }
204 208
         $event->preventDefault();
205 209
         $event->stopPropagation();
206 210
 
Please login to merge, or discard this patch.
helper/db.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 // must be run within Dokuwiki
10 10
 use dokuwiki\plugin\issuelinks\classes\Issue;
11 11
 
12
-if(!defined('DOKU_INC')) die();
12
+if (!defined('DOKU_INC')) die();
13 13
 
14 14
 class helper_plugin_issuelinks_db extends DokuWiki_Plugin
15 15
 {
@@ -24,22 +24,22 @@  discard block
 block discarded – undo
24 24
      * @throws Exception Only thrown in unittests
25 25
      */
26 26
     public function getDB() {
27
-        if(null === $this->db) {
27
+        if (null === $this->db) {
28 28
             /** @var helper_plugin_sqlite $sqlite */
29 29
             $sqlite = plugin_load('helper', 'sqlite');
30
-            if(!$sqlite) {
30
+            if (!$sqlite) {
31 31
                 msg('This plugin requires the sqlite plugin. Please install it', -1);
32 32
                 return null;
33 33
             }
34 34
 
35
-            if($sqlite->getAdapter()->getName() !== DOKU_EXT_PDO) {
36
-                if(defined('DOKU_UNITTEST')) throw new \Exception('Couldn\'t load PDO sqlite.');
35
+            if ($sqlite->getAdapter()->getName() !== DOKU_EXT_PDO) {
36
+                if (defined('DOKU_UNITTEST')) throw new \Exception('Couldn\'t load PDO sqlite.');
37 37
                 return null;
38 38
             }
39 39
             $sqlite->getAdapter()->setUseNativeAlter(true);
40 40
 
41 41
             // initialize the database connection
42
-            if(!$sqlite->init('issuelinks', DOKU_PLUGIN . 'issuelinks/db/')) {
42
+            if (!$sqlite->init('issuelinks', DOKU_PLUGIN . 'issuelinks/db/')) {
43 43
                 return null;
44 44
             }
45 45
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function saveKeyValuePair($key, $value) {
61 61
         $db = $this->getDB();
62
-        if(!$db) return false;
62
+        if (!$db) return false;
63 63
         $sql = 'REPLACE INTO opts VALUES (?, ?)';
64 64
         $db->query($sql, array($key, $value));
65 65
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function getKeyValue($key) {
74 74
         $db = $this->getDB();
75
-        if(!$db) return false;
75
+        if (!$db) return false;
76 76
         $sql = 'SELECT val FROM opts WHERE opt = ?';
77 77
         $res = $db->query($sql, array($key));
78 78
         $value = $db->res2single($res);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * @return bool
133 133
      */
134 134
     public function saveIssue(Issue $issue) {
135
-        $ok = $this->saveEntity('issues', array (
135
+        $ok = $this->saveEntity('issues', array(
136 136
             'service' => $issue->getServiceName(),
137 137
             'project' => $issue->getProject(),
138 138
             'id' => $issue->getKey(),
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
             'type' => $issue->getType(),
143 143
             'status' => $issue->getStatus(),
144 144
             'parent' => $issue->getParent(),
145
-            'components' => implode(',',$issue->getComponents()),
145
+            'components' => implode(',', $issue->getComponents()),
146 146
             'labels' => implode(',', $issue->getLabels()),
147 147
             'priority' => $issue->getPriority(),
148 148
             'duedate' => $issue->getDuedate(),
149 149
             'versions' => implode(',', $issue->getVersions()),
150 150
             'updated' => $issue->getUpdated()
151 151
         ));
152
-        return (bool)$ok;
152
+        return (bool) $ok;
153 153
     }
154 154
 
155 155
 
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
     public function removeOldLinks($serviceName, $projectKey, $issue_id, $isMergeRequest, $pages) {
237 237
         $activeLinks = array();
238 238
 
239
-        foreach($pages as $linkingPage) {
239
+        foreach ($pages as $linkingPage) {
240 240
             $changelog = new PageChangelog($linkingPage['page']);
241 241
             $currentRev = $changelog->getRelativeRevision(time(), -1);
242
-            if($linkingPage['rev'] < $currentRev) {
242
+            if ($linkingPage['rev'] < $currentRev) {
243 243
                 $entity = array(
244 244
                     'page'     => $linkingPage['page'],
245 245
                     'issue_id' => $issue_id,
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         if (!$util->isValidTimeStamp($rev)) {
277 277
             throw new InvalidArgumentException("Second parameter must be a valid timestamp!");
278 278
         }
279
-        if ((int)$rev === 0) {
279
+        if ((int) $rev === 0) {
280 280
             $rev = filemtime(wikiFN($page));
281 281
             $changelog = new PageChangelog($page);
282 282
             $rev_info = $changelog->getRevisionInfo($rev);
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
             $this->savePageRev($page, $rev, $rev_info['sum'], $user);
285 285
         }
286 286
         /** @noinspection TypeUnsafeComparisonInspection this is done to ensure $issue_id is a natural number */
287
-        if (!is_numeric($issue_id) || (int)$issue_id != $issue_id) {
287
+        if (!is_numeric($issue_id) || (int) $issue_id != $issue_id) {
288 288
             throw new InvalidArgumentException("IssueId must be an integer!");
289 289
         }
290
-        $ok = $this->saveEntity('pagerev_issues', array (
290
+        $ok = $this->saveEntity('pagerev_issues', array(
291 291
             'page' => $page,
292 292
             'rev' => $rev,
293 293
             'service' => $serviceName,
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             'type' => $type
298 298
         ));
299 299
 
300
-        return (bool)$ok;
300
+        return (bool) $ok;
301 301
     }
302 302
 
303 303
     /**
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
         if (!$util->isValidTimeStamp($rev)) {
319 319
             throw new InvalidArgumentException("Second parameter must be a valid timestamp!");
320 320
         }
321
-        $ok = $this->saveEntity('pagerevs', array (
321
+        $ok = $this->saveEntity('pagerevs', array(
322 322
             'page' => $page,
323 323
             'rev' => $rev,
324 324
             'summary' => $summary,
325 325
             'user' => $user,
326 326
         ));
327
-        return (bool)$ok;
327
+        return (bool) $ok;
328 328
     }
329 329
 
330 330
     /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      */
358 358
     private function deleteEntity($table, $entity) {
359 359
         $db = $this->getDB();
360
-        if(!$db) return;
360
+        if (!$db) return;
361 361
 
362 362
         $where = implode(' = ? AND ', array_keys($entity)) . ' = ?';
363 363
         $vals = array_values($entity);
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
      */
376 376
     private function saveEntity($table, $entity) {
377 377
         $db = $this->getDB();
378
-        if(!$db) return false;
378
+        if (!$db) return false;
379 379
 
380 380
         $keys = implode(', ', array_keys($entity));
381 381
         $vals = array_values($entity);
@@ -403,16 +403,16 @@  discard block
 block discarded – undo
403 403
      * @return array|bool
404 404
      */
405 405
     private function sqlArrayQuery($sql, $conditional) {
406
-        if (substr(trim($sql),0,strlen('SELECT')) !== 'SELECT') {
406
+        if (substr(trim($sql), 0, strlen('SELECT')) !== 'SELECT') {
407 407
             throw new InvalidArgumentException("SQL-Statement must be a SELECT statement! \n" . $sql);
408 408
         }
409
-        if (strpos(trim($sql,';'), ';') !== false) {
409
+        if (strpos(trim($sql, ';'), ';') !== false) {
410 410
             throw new InvalidArgumentException("SQL-Statement must be one single statement! \n" . $sql);
411 411
         }
412 412
         $db = $this->getDB();
413
-        if(!$db) return false;
413
+        if (!$db) return false;
414 414
 
415
-        $res = $db->query($sql,$conditional);
415
+        $res = $db->query($sql, $conditional);
416 416
         $result = $db->res2arr($res);
417 417
         $db->res_close($res);
418 418
         return $result;
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 // must be run within Dokuwiki
10 10
 use dokuwiki\plugin\issuelinks\classes\Issue;
11 11
 
12
-if(!defined('DOKU_INC')) die();
12
+if(!defined('DOKU_INC')) {
13
+    die();
14
+}
13 15
 
14 16
 class helper_plugin_issuelinks_db extends DokuWiki_Plugin
15 17
 {
@@ -33,7 +35,9 @@  discard block
 block discarded – undo
33 35
             }
34 36
 
35 37
             if($sqlite->getAdapter()->getName() !== DOKU_EXT_PDO) {
36
-                if(defined('DOKU_UNITTEST')) throw new \Exception('Couldn\'t load PDO sqlite.');
38
+                if(defined('DOKU_UNITTEST')) {
39
+                    throw new \Exception('Couldn\'t load PDO sqlite.');
40
+                }
37 41
                 return null;
38 42
             }
39 43
             $sqlite->getAdapter()->setUseNativeAlter(true);
@@ -59,7 +63,9 @@  discard block
 block discarded – undo
59 63
      */
60 64
     public function saveKeyValuePair($key, $value) {
61 65
         $db = $this->getDB();
62
-        if(!$db) return false;
66
+        if(!$db) {
67
+            return false;
68
+        }
63 69
         $sql = 'REPLACE INTO opts VALUES (?, ?)';
64 70
         $db->query($sql, array($key, $value));
65 71
     }
@@ -72,7 +78,9 @@  discard block
 block discarded – undo
72 78
      */
73 79
     public function getKeyValue($key) {
74 80
         $db = $this->getDB();
75
-        if(!$db) return false;
81
+        if(!$db) {
82
+            return false;
83
+        }
76 84
         $sql = 'SELECT val FROM opts WHERE opt = ?';
77 85
         $res = $db->query($sql, array($key));
78 86
         $value = $db->res2single($res);
@@ -357,7 +365,9 @@  discard block
 block discarded – undo
357 365
      */
358 366
     private function deleteEntity($table, $entity) {
359 367
         $db = $this->getDB();
360
-        if(!$db) return;
368
+        if(!$db) {
369
+            return;
370
+        }
361 371
 
362 372
         $where = implode(' = ? AND ', array_keys($entity)) . ' = ?';
363 373
         $vals = array_values($entity);
@@ -375,7 +385,9 @@  discard block
 block discarded – undo
375 385
      */
376 386
     private function saveEntity($table, $entity) {
377 387
         $db = $this->getDB();
378
-        if(!$db) return false;
388
+        if(!$db) {
389
+            return false;
390
+        }
379 391
 
380 392
         $keys = implode(', ', array_keys($entity));
381 393
         $vals = array_values($entity);
@@ -410,7 +422,9 @@  discard block
 block discarded – undo
410 422
             throw new InvalidArgumentException("SQL-Statement must be one single statement! \n" . $sql);
411 423
         }
412 424
         $db = $this->getDB();
413
-        if(!$db) return false;
425
+        if(!$db) {
426
+            return false;
427
+        }
414 428
 
415 429
         $res = $db->query($sql,$conditional);
416 430
         $result = $db->res2arr($res);
Please login to merge, or discard this patch.
helper/data.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
 use dokuwiki\plugin\issuelinks\classes\ServiceProvider;
11 11
 
12 12
 // must be run within Dokuwiki
13
-if(!defined('DOKU_INC')) die();
13
+if(!defined('DOKU_INC')) {
14
+    die();
15
+}
14 16
 
15 17
 class helper_plugin_issuelinks_data extends DokuWiki_Plugin {
16 18
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use dokuwiki\plugin\issuelinks\classes\ServiceProvider;
11 11
 
12 12
 // must be run within Dokuwiki
13
-if(!defined('DOKU_INC')) die();
13
+if (!defined('DOKU_INC')) die();
14 14
 
15 15
 class helper_plugin_issuelinks_data extends DokuWiki_Plugin {
16 16
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     public function getLockContent($id)
104 104
     {
105 105
         global $conf;
106
-        $lockFN = $conf['lockdir'].'/'.md5('_' . $id).'.lock';
106
+        $lockFN = $conf['lockdir'] . '/' . md5('_' . $id) . '.lock';
107 107
         if (!file_exists($lockFN)) {
108 108
             return false;
109 109
         }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     public function lockImport($id, $jsonData) {
124 124
         global $conf;
125 125
 
126
-        $lock = $conf['lockdir'].'/'.md5('_' . $id).'.lock';
126
+        $lock = $conf['lockdir'] . '/' . md5('_' . $id) . '.lock';
127 127
         dbglog('lock import: ' . $jsonData, __FILE__ . ': ' . __LINE__);
128 128
         io_saveFile($lock, $jsonData);
129 129
     }
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
      */
141 141
     public function isImportLocked($id) {
142 142
         global $conf;
143
-        $lockFN = $conf['lockdir'].'/'.md5('_' . $id).'.lock';
144
-        if(!file_exists($lockFN)) {
143
+        $lockFN = $conf['lockdir'] . '/' . md5('_' . $id) . '.lock';
144
+        if (!file_exists($lockFN)) {
145 145
             return false;
146 146
         }
147 147
 
148 148
         clearstatcache($lockFN);
149
-        if((time() - filemtime($lockFN)) > 120) { // todo: decide if we want this to be configurable?
149
+        if ((time() - filemtime($lockFN)) > 120) { // todo: decide if we want this to be configurable?
150 150
             @unlink($lockFN);
151 151
             dbglog('issuelinks: stale lock timeout');
152 152
             return false;
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
         }
167 167
 
168 168
         global $conf, $INPUT;
169
-        $lockFN = $conf['lockdir'].'/'.md5('_' . $id).'.lock';
169
+        $lockFN = $conf['lockdir'] . '/' . md5('_' . $id) . '.lock';
170 170
         $lockData = json_decode(io_readFile($lockFN), true);
171
-        if($lockData['user'] !== $INPUT->server->str('REMOTE_USER')) {
171
+        if ($lockData['user'] !== $INPUT->server->str('REMOTE_USER')) {
172 172
             return false;
173 173
         }
174 174
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function unlockImport($id) {
186 186
         global $conf;
187
-        $lockFN = $conf['lockdir'].'/'.md5('_' . $id).'.lock';
187
+        $lockFN = $conf['lockdir'] . '/' . md5('_' . $id) . '.lock';
188 188
         $lockData = json_decode(io_readFile($lockFN), true);
189 189
         $lockData['status'] = 'done';
190 190
         $lockData['total'] = $lockData['count'];
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     public function removeLock($lockID)
195 195
     {
196 196
         global $conf;
197
-        $lockFN = $conf['lockdir'].'/'.md5('_' . $lockID).'.lock';
197
+        $lockFN = $conf['lockdir'] . '/' . md5('_' . $lockID) . '.lock';
198 198
         unlink($lockFN);
199 199
     }
200 200
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     public function getIssue($pmServiceName, $project, $issueid, $isMergeRequest) {
241 241
         $issue = Issue::getInstance($pmServiceName, $project, $issueid, $isMergeRequest);
242
-        if(!$issue->isValid()) {
242
+        if (!$issue->isValid()) {
243 243
             try {
244 244
                 $issue->getFromService();
245 245
                 $issue->saveToDB();
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 
275 275
         $repoMatches = array();
276 276
         $repoPattern = '/(\w+\/)?([\w\.\-_]+)?([#!])(\d+)(?:[\.,\s]|$)/';
277
-        preg_match_all($repoPattern, $message, $repoMatches,PREG_SET_ORDER);
277
+        preg_match_all($repoPattern, $message, $repoMatches, PREG_SET_ORDER);
278 278
         list($currentNamespace, $currentRepo) = explode('/', $repoId);
279 279
         foreach ($repoMatches as $match) {
280 280
             if ($rmServiceName !== 'gitlab' && $match[3] === '!') {
281 281
                 continue; // only gitlab has `!` has separator
282 282
             }
283
-            $namespace = empty($match[1]) ? $currentNamespace : trim($match[1],'/');
283
+            $namespace = empty($match[1]) ? $currentNamespace : trim($match[1], '/');
284 284
             $repo = empty($match[2]) ? $currentRepo : $match[2];
285 285
             $issues[] = array('pmService' => $rmServiceName,
286 286
                 'project' => "$namespace/$repo",
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     public function keepNewest($pages) {
320 320
         $uniquePages = array();
321 321
         foreach ($pages as $page) {
322
-            if (!array_key_exists($page['page'],$uniquePages) || $uniquePages[$page['page']]['rev'] < $page['rev'] ) {
322
+            if (!array_key_exists($page['page'], $uniquePages) || $uniquePages[$page['page']]['rev'] < $page['rev']) {
323 323
                 $uniquePages[$page['page']] = $page;
324 324
             }
325 325
         }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     private function filterPagesForACL($pages) {
337 337
         $allowedPagegs = array();
338 338
         foreach ($pages as $page) {
339
-            if(auth_quickaclcheck($page['page']) >= AUTH_READ) {
339
+            if (auth_quickaclcheck($page['page']) >= AUTH_READ) {
340 340
                 $allowedPagegs[] = $page;
341 341
             }
342 342
         }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         $config = new dokuwiki\plugin\struct\meta\ConfigParser($configLines);
436 436
         $search = new dokuwiki\plugin\struct\meta\SearchConfig($config->getConfig());
437 437
         $results = $search->execute();
438
-        $pages = array_map(function($result) { return array('page' => $result[0]->getRawValue(), 'rev' => 0);}, $results);
438
+        $pages = array_map(function($result) { return array('page' => $result[0]->getRawValue(), 'rev' => 0); }, $results);
439 439
         return $pages;
440 440
     }
441 441
 
Please login to merge, or discard this patch.
helper/util.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // must be run within Dokuwiki
10
-if(!defined('DOKU_INC')) die();
10
+if (!defined('DOKU_INC')) die();
11 11
 
12 12
 class helper_plugin_issuelinks_util extends DokuWiki_Plugin {
13 13
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      * @param string $linkHeader
18 18
      * @return array
19 19
      */
20
-    public function parseHTTPLinkHeaders ($linkHeader) {
20
+    public function parseHTTPLinkHeaders($linkHeader) {
21 21
         $links = explode(',', $linkHeader);
22 22
         $linkarray = array();
23 23
         foreach ($links as $linkstring) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function reportException(Exception $e) {
67 67
         msg(hsc($e->getMessage()), -1, $e->getLine(), $e->getFile());
68 68
         global $conf;
69
-        if($conf['allowdebug']) {
69
+        if ($conf['allowdebug']) {
70 70
             msg('<pre>' . hsc($e->getTraceAsString()) . '</pre>', -1);
71 71
         }
72 72
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function sendResponse($code, $msg) {
79 79
         header('Content-Type: application/json');
80
-        if ((int)$code === 204) {
80
+        if ((int) $code === 204) {
81 81
             http_status(200);
82 82
         } else {
83 83
             http_status($code);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @return bool
97 97
      */
98 98
     public function isValidTimeStamp($timestamp) {
99
-        return ((string) (int) $timestamp === (string)$timestamp);
99
+        return ((string) (int) $timestamp === (string) $timestamp);
100 100
     }
101 101
 
102 102
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 // must be run within Dokuwiki
10
-if(!defined('DOKU_INC')) die();
10
+if(!defined('DOKU_INC')) {
11
+    die();
12
+}
11 13
 
12 14
 class helper_plugin_issuelinks_util extends DokuWiki_Plugin {
13 15
 
Please login to merge, or discard this patch.
services/AbstractService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
     public static function getInstance($forcereload = false) {
10 10
         $class = static::class;
11
-        if(empty(self::$instance[$class]) || $forcereload) {
11
+        if (empty(self::$instance[$class]) || $forcereload) {
12 12
             self::$instance[$class] = new $class();
13 13
         }
14 14
         return self::$instance[$class];
Please login to merge, or discard this patch.
services/GitLab.service.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $groups = $this->makeSingleGitLabGetRequest('/groups');
118 118
 
119
-        return array_map(function ($group) {
119
+        return array_map(function($group) {
120 120
             return $group['full_path'];
121 121
         }, $groups);
122 122
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             try {
140 140
                 $repoHooks = $this->makeSingleGitLabGetRequest("/projects/$organisation%2F{$project['path']}/hooks?per_page=100");
141 141
             } catch (HTTPRequestException $e) {
142
-                $repo->error = (int)$e->getCode();
142
+                $repo->error = (int) $e->getCode();
143 143
             }
144 144
 
145 145
             $repoHooks = array_filter($repoHooks, array($this, 'isOurIssueHook'));
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     public function retrieveAllIssues($projectKey, &$startat = 0)
316 316
     {
317 317
         $perPage = 100;
318
-        $page = ceil(($startat+1)/$perPage);
318
+        $page = ceil(($startat + 1) / $perPage);
319 319
         $endpoint = '/projects/' . urlencode($projectKey) . "/issues?page=$page&per_page=$perPage";
320 320
         $issues = $this->makeSingleGitLabGetRequest($endpoint);
321 321
         $this->total = $this->estimateTotal($perPage, count($issues));
Please login to merge, or discard this patch.
services/GitHub.service.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -334,7 +334,7 @@
 block discarded – undo
334 334
             }
335 335
         }
336 336
         // fixme: add 'user repos'!
337
-        return array_map(function ($org) {
337
+        return array_map(function($org) {
338 338
             return $org['login'];
339 339
         }, $this->orgs);
340 340
     }
Please login to merge, or discard this patch.
classes/Issue.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      * @return Issue
69 69
      */
70 70
     public static function getInstance($serviceName, $projectKey, $issueId, $isMergeRequest = false, $forcereload = false) {
71
-        $issueHash = $serviceName.$projectKey.$issueId.'!'.$isMergeRequest;
72
-        if(empty(self::$instances[$issueHash]) || $forcereload) {
71
+        $issueHash = $serviceName . $projectKey . $issueId . '!' . $isMergeRequest;
72
+        if (empty(self::$instances[$issueHash]) || $forcereload) {
73 73
             self::$instances[$issueHash] = new Issue($serviceName, $projectKey, $issueId, $isMergeRequest);
74 74
         }
75 75
         return self::$instances[$issueHash];
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
     public function __toString() {
132 132
         $sep = $this->pmService->getProjectIssueSeparator($this->isMergeRequest);
133
-        return $this->projectId . $sep .$this->issueId;
133
+        return $this->projectId . $sep . $this->issueId;
134 134
     }
135 135
 
136 136
     /**
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
      */
285 285
     public function setComponents($components) {
286 286
         if (!is_array($components)) {
287
-            $components = array_filter(array_map('trim', explode(',',$components)));
287
+            $components = array_filter(array_map('trim', explode(',', $components)));
288 288
         }
289 289
         if (!empty($components[0]['name'])) {
290
-            $components = array_map(function($component){return $component['name'];},$components);
290
+            $components = array_map(function($component) {return $component['name']; },$components);
291 291
         }
292 292
         $this->components = $components;
293 293
         return $this;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function setLabels($labels) {
301 301
         if (!is_array($labels)) {
302
-            $labels = array_filter(array_map('trim', explode(',',$labels)));
302
+            $labels = array_filter(array_map('trim', explode(',', $labels)));
303 303
         }
304 304
         $this->labels = $labels;
305 305
         return $this;
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public function setVersions($versions) {
313 313
         if (!is_array($versions)) {
314
-            $versions = array_map('trim', explode(',',$versions));
314
+            $versions = array_map('trim', explode(',', $versions));
315 315
         }
316 316
         if (!empty($versions[0]['name'])) {
317
-            $versions = array_map(function($version){return $version['name'];},$versions);
317
+            $versions = array_map(function($version) {return $version['name']; },$versions);
318 318
         }
319 319
         $this->versions = $versions;
320 320
         return $this;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         if (!$util->isValidTimeStamp($updated)) {
331 331
             $updated = strtotime($updated);
332 332
         }
333
-        $this->updated = (int)$updated;
333
+        $this->updated = (int) $updated;
334 334
         return $this;
335 335
     }
336 336
 
@@ -639,16 +639,16 @@  discard block
 block discarded – undo
639 639
      */
640 640
     private function calculateColor($color) {
641 641
         /** @noinspection PrintfScanfArgumentsInspection */
642
-        list($r, $g, $b) = array_map(function($color8bit){
643
-            $c = $color8bit/255;
642
+        list($r, $g, $b) = array_map(function($color8bit) {
643
+            $c = $color8bit / 255;
644 644
             if ($c <= 0.03928) {
645
-                $cl = $c/12.92;
645
+                $cl = $c / 12.92;
646 646
             } else {
647
-                $cl = pow(($c+0.055)/1.055,2.4);
647
+                $cl = pow(($c + 0.055) / 1.055, 2.4);
648 648
             }
649 649
             return $cl;
650 650
         }, sscanf($color, "%02x%02x%02x"));
651
-        if ($r*0.2126 + $g*0.7152 + $b*0.0722 > 0.179) {
651
+        if ($r * 0.2126 + $g * 0.7152 + $b * 0.0722 > 0.179) {
652 652
             return '#000000';
653 653
         }
654 654
         return '#FFFFFF';
Please login to merge, or discard this patch.