Passed
Push — master ( 75d456...236a2f )
by Michael
02:15
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.
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.
classes/IssueLinksException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         /** @var \helper_plugin_struct $plugin */
24 24
         $plugin = plugin_load('helper', 'issuelinks_util');
25 25
         $trans = $plugin->getLang($this->trans_prefix . $message);
26
-        if(!$trans) {
26
+        if (!$trans) {
27 27
             $trans = $message;
28 28
         }
29 29
 
Please login to merge, or discard this patch.
classes/ServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     protected $serviceClasses = [];
12 12
 
13 13
     public static function getInstance($forcereload = false) {
14
-        if(null === self::$instance || $forcereload) {
14
+        if (null === self::$instance || $forcereload) {
15 15
             self::$instance = new self();
16 16
         }
17 17
         return self::$instance;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $serviceDir = __DIR__ . '/../services';
50 50
         $filenames = scandir($serviceDir, SCANDIR_SORT_ASCENDING);
51 51
         foreach ($filenames as $filename) {
52
-            if ($filename === '.' || $filename === '..' ) {
52
+            if ($filename === '.' || $filename === '..') {
53 53
                 continue;
54 54
             }
55 55
             list($service, $servicePostfix) = explode('.', $filename, 2);
Please login to merge, or discard this patch.