Completed
Branch develop (a99e44)
by
unknown
15:19
created
htdocs/includes/restler/framework/Luracast/Restler/Defaults.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -353,7 +353,9 @@
 block discarded – undo
353 353
      */
354 354
     public static function setProperty($name, $value)
355 355
     {
356
-        if (!property_exists(__CLASS__, $name)) return false;
356
+        if (!property_exists(__CLASS__, $name)) {
357
+        	return false;
358
+        }
357 359
         if (@is_array(Defaults::$validation[$name])) {
358 360
             $info = new ValidationInfo(Defaults::$validation[$name]);
359 361
             $value = Validator::validate($value, $info);
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Util.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -243,7 +243,9 @@
 block discarded – undo
243 243
     public static function getShortName($className)
244 244
     {
245 245
     	// @CHANGE LDR
246
-    	if (!is_string($className)) return;
246
+    	if (!is_string($className)) {
247
+    		return;
248
+    	}
247 249
     	
248 250
     	$className = explode('\\', $className);
249 251
         return end($className);
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/UI/Tags.php 1 patch
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@  discard block
 block discarded – undo
55 55
         }
56 56
         $this->markAsChildren($c);
57 57
         $this->children = $c;
58
-        if (static::$initializer)
59
-            call_user_func_array(static::$initializer, array(& $this));
58
+        if (static::$initializer) {
59
+                    call_user_func_array(static::$initializer, array(& $this));
60
+        }
60 61
     }
61 62
 
62 63
     /**
@@ -98,8 +99,9 @@  discard block
 block discarded – undo
98 99
             $lineBreak = false;
99 100
             foreach ($this->children as $key => $child) {
100 101
                 $prefix = $this->prefix;
101
-                if (!is_null($this->tag))
102
-                    $prefix .= $this->indent;
102
+                if (!is_null($this->tag)) {
103
+                                    $prefix .= $this->indent;
104
+                }
103 105
                 if ($child instanceof $this) {
104 106
                     $child->prefix = $prefix;
105 107
                     $child->indent = $this->indent;
@@ -109,23 +111,27 @@  discard block
 block discarded – undo
109 111
                     $children .= $child;
110 112
                 }
111 113
             }
112
-            if ($lineBreak)
113
-                $children .= PHP_EOL . $this->prefix;
114
+            if ($lineBreak) {
115
+                            $children .= PHP_EOL . $this->prefix;
116
+            }
114 117
         } else {
115 118
             $children = implode('', $this->children);
116 119
         }
117
-        if (is_null($this->tag))
118
-            return $children;
120
+        if (is_null($this->tag)) {
121
+                    return $children;
122
+        }
119 123
         $attributes = '';
120
-        foreach ($this->attributes as $attribute => &$value)
121
-            $attributes .= " $attribute=\"$value\"";
124
+        foreach ($this->attributes as $attribute => &$value) {
125
+                    $attributes .= " $attribute=\"$value\"";
126
+        }
122 127
 
123
-        if (count($this->children))
124
-            return static::$humanReadable
128
+        if (count($this->children)) {
129
+                    return static::$humanReadable
125 130
                 ? "$this->prefix<{$this->tag}{$attributes}>"
126 131
                 . "$children"
127 132
                 . "</{$this->tag}>"
128 133
                 : "<{$this->tag}{$attributes}>$children</{$this->tag}>";
134
+        }
129 135
 
130 136
         return "$this->prefix<{$this->tag}{$attributes}/>";
131 137
     }
@@ -163,10 +169,12 @@  discard block
 block discarded – undo
163 169
 
164 170
     public function __get($name)
165 171
     {
166
-        if ('parent' == $name)
167
-            return $this->_parent;
168
-        if (isset($this->attributes[$name]))
169
-            return $this->attributes[$name];
172
+        if ('parent' == $name) {
173
+                    return $this->_parent;
174
+        }
175
+        if (isset($this->attributes[$name])) {
176
+                    return $this->attributes[$name];
177
+        }
170 178
         return;
171 179
     }
172 180
 
@@ -265,8 +273,9 @@  discard block
 block discarded – undo
265 273
     private function markAsChildren(& $children)
266 274
     {
267 275
         foreach ($children as $i => $child) {
268
-            if (is_string($child))
269
-                continue;
276
+            if (is_string($child)) {
277
+                            continue;
278
+            }
270 279
             if (!is_object($child)) {
271 280
                 unset($children[$i]);
272 281
                 continue;
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/UI/Nav.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,23 +57,26 @@  discard block
 block discarded – undo
57 57
         if (empty(static::$tree)) {
58 58
             /** @var Restler $restler */
59 59
             $restler = Scope::get('Restler');
60
-            if (static::$addExtension)
61
-                static::$extension = isset($restler->responseFormat)
60
+            if (static::$addExtension) {
61
+                            static::$extension = isset($restler->responseFormat)
62 62
                     ? '.' . $restler->responseFormat->getExtension()
63 63
                     : '.html';
64
+            }
64 65
             static::$url = $restler->getBaseUrl();
65
-            if (empty(static::$url))
66
-                static::$url = '';
66
+            if (empty(static::$url)) {
67
+                            static::$url = '';
68
+            }
67 69
             static::$activeTrail = $activeTrail = empty($activeTrail)
68 70
                 ? (empty($restler->url) || $restler->url == 'index'
69 71
                     ? static::$root
70 72
                     : $restler->url
71 73
                 )
72 74
                 : $activeTrail;
73
-            if (static::$addExtension)
74
-                static::$extension = isset($restler->responseFormat)
75
+            if (static::$addExtension) {
76
+                            static::$extension = isset($restler->responseFormat)
75 77
                     ? '.' . $restler->responseFormat->getExtension()
76 78
                     : '.html';
79
+            }
77 80
             static::addUrls(static::$prepends);
78 81
             $map = Routes::findAll(
79 82
                 static::$excludedPaths,
@@ -169,8 +172,9 @@  discard block
 block discarded – undo
169 172
         //remove / prefix and / suffixes and any extension
170 173
         $trail = strtok(trim($trail, '/'), '.');
171 174
         $parts = explode('/', $trail);
172
-        if (count($parts) == 1 && empty($parts[0]))
173
-            $parts = array(static::$root);
175
+        if (count($parts) == 1 && empty($parts[0])) {
176
+                    $parts = array(static::$root);
177
+        }
174 178
         if (isset($r['fragment'])) {
175 179
             $parts[] = $r['fragment'];
176 180
             if (is_null($label)) {
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function make($string, $data = null)
27 27
     {
28
-        if (!strlen($string))
29
-            return array();
28
+        if (!strlen($string)) {
29
+                    return array();
30
+        }
30 31
 
31 32
         $implicitTag =
32 33
             function () use (& $tag) {
@@ -66,8 +67,8 @@  discard block
 block discarded – undo
66 67
                 & $tokens, & $tag
67 68
             ) {
68 69
                 $digits = 0;
69
-                if ($delimiter == null)
70
-                    $delimiter = array(
70
+                if ($delimiter == null) {
71
+                                    $delimiter = array(
71 72
                         '.' => true,
72 73
                         '#' => true,
73 74
                         '*' => true,
@@ -78,6 +79,7 @@  discard block
 block discarded – undo
78 79
                         ']' => true,
79 80
                         '=' => true,
80 81
                     );
82
+                }
81 83
                 while (!empty($tokens) &&
82 84
                     !isset($delimiter[$t = array_shift($tokens)])) {
83 85
                     while ('$' === $t) {
@@ -126,8 +128,9 @@  discard block
 block discarded – undo
126 128
                         $text .= $t;
127 129
                     }
128 130
                 }
129
-                if (isset($t))
130
-                    array_unshift($tokens, $t);
131
+                if (isset($t)) {
132
+                                    array_unshift($tokens, $t);
133
+                }
131 134
                 return $text;
132 135
             };
133 136
 
@@ -137,8 +140,9 @@  discard block
 block discarded – undo
137 140
                 $a = $parseText(
138 141
                     '', $round, $total, $data
139 142
                 );
140
-                if (is_null($a))
141
-                    return;
143
+                if (is_null($a)) {
144
+                                    return;
145
+                }
142 146
                 if ('=' == ($v = array_shift($tokens))) {
143 147
                     //value
144 148
                     if ('"' == ($v = array_shift($tokens))) {
@@ -266,11 +270,13 @@  discard block
 block discarded – undo
266 270
                                 break;
267 271
                             }
268 272
                             $tag = $tag->parent;
269
-                            if ($tag->parent)
270
-                                $tag = $tag->parent;
273
+                            if ($tag->parent) {
274
+                                                            $tag = $tag->parent;
275
+                            }
271 276
                             while ('^' == ($t = array_shift($tokens))) {
272
-                                if ($tag->parent)
273
-                                    $tag = $tag->parent;
277
+                                if ($tag->parent) {
278
+                                                                    $tag = $tag->parent;
279
+                                }
274 280
                             }
275 281
                             $child = new T($t);
276 282
                             $tag[] = $child;
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Filter/RateLimit.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,9 @@  discard block
 block discarded – undo
78 78
     {
79 79
         if (static::$authenticatedUsagePerUnit
80 80
             == static::$usagePerUnit
81
-        ) return $this->check();
81
+        ) {
82
+        	return $this->check();
83
+        }
82 84
         return null;
83 85
     }
84 86
 
@@ -90,11 +92,12 @@  discard block
 block discarded – undo
90 92
 
91 93
     private static function validate($unit)
92 94
     {
93
-        if (!isset(static::$units[$unit]))
94
-            throw new \InvalidArgumentException(
95
+        if (!isset(static::$units[$unit])) {
96
+                    throw new \InvalidArgumentException(
95 97
                 'Rate Limit time unit should be '
96 98
                 . implode('|', array_keys(static::$units)) . '.'
97 99
             );
100
+        }
98 101
     }
99 102
 
100 103
     private function check($isAuthenticated = false)
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Format/CsvFormat.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -106,8 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
         static::$haveHeaders ? $keys = $row : $decoded[] = $row;
108 108
 
109
-        while (($row = static::getRow(array_shift($lines), $keys)) !== FALSE)
110
-            $decoded [] = $row;
109
+        while (($row = static::getRow(array_shift($lines), $keys)) !== FALSE) {
110
+                    $decoded [] = $row;
111
+        }
111 112
 
112 113
         $char = Obj::$separatorChar;
113 114
         Obj::$separatorChar = false;
@@ -130,11 +131,13 @@  discard block
 block discarded – undo
130 131
 
131 132
         $row = array();
132 133
         foreach ($line as $key => $value) {
133
-            if (is_numeric($value))
134
-                $value = floatval($value);
134
+            if (is_numeric($value)) {
135
+                            $value = floatval($value);
136
+            }
135 137
             if ($keys) {
136
-                if (isset($keys [$key]))
137
-                    $row [$keys [$key]] = $value;
138
+                if (isset($keys [$key])) {
139
+                                    $row [$keys [$key]] = $value;
140
+                }
138 141
             } else {
139 142
                 $row [$key] = $value;
140 143
             }
@@ -169,8 +172,9 @@  discard block
 block discarded – undo
169 172
 
170 173
         static::$haveHeaders ? $keys = $row : $decoded[] = $row;
171 174
 
172
-        while (($row = static::getRow(stream_get_line($stream, 0, PHP_EOL), $keys)) !== FALSE)
173
-            $decoded [] = $row;
175
+        while (($row = static::getRow(stream_get_line($stream, 0, PHP_EOL), $keys)) !== FALSE) {
176
+                    $decoded [] = $row;
177
+        }
174 178
 
175 179
         $char = Obj::$separatorChar;
176 180
         Obj::$separatorChar = false;
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Format/UploadFormat.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,8 +118,9 @@  discard block
 block discarded – undo
118 118
                     foreach ($file as $property => $value) {
119 119
                         $innerFile[$property] = $value[$i];
120 120
                     }
121
-                    if ($innerFile['name'])
122
-                        static::checkFile($innerFile, $doMimeCheck, $doSizeCheck);
121
+                    if ($innerFile['name']) {
122
+                                            static::checkFile($innerFile, $doMimeCheck, $doSizeCheck);
123
+                    }
123 124
 
124 125
                     if (isset($innerFile['exception'])) {
125 126
                         $file['error'][$i] = $innerFile['error'];
@@ -128,8 +129,9 @@  discard block
 block discarded – undo
128 129
                     }
129 130
                 }
130 131
             } else {
131
-                if ($file['name'])
132
-                    static::checkFile($file, $doMimeCheck, $doSizeCheck);
132
+                if ($file['name']) {
133
+                                    static::checkFile($file, $doMimeCheck, $doSizeCheck);
134
+                }
133 135
                 if (isset($innerFile['exception'])) {
134 136
                     break;
135 137
                 }
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Routes.php 1 patch
Braces   +45 added lines, -26 removed lines patch added patch discarded remove patch
@@ -124,9 +124,10 @@  discard block
 block discarded – undo
124 124
                 $metadata['param'] = array();
125 125
             }
126 126
             if (isset($metadata['return']['type'])) {
127
-                if ($qualified = Scope::resolve($metadata['return']['type'], $scope))
128
-                    list($metadata['return']['type'], $metadata['return']['children']) =
127
+                if ($qualified = Scope::resolve($metadata['return']['type'], $scope)) {
128
+                                    list($metadata['return']['type'], $metadata['return']['children']) =
129 129
                         static::getTypeAndModel(new ReflectionClass($qualified), $scope);
130
+                }
130 131
             } else {
131 132
                 //assume return type is array
132 133
                 $metadata['return']['type'] = 'array';
@@ -147,8 +148,9 @@  discard block
 block discarded – undo
147 148
                     $m[$dataName] = array();
148 149
                 }
149 150
                 $p = &$m[$dataName];
150
-                if (empty($m['label']))
151
-                    $m['label'] = Text::title($m['name']);
151
+                if (empty($m['label'])) {
152
+                                    $m['label'] = Text::title($m['name']);
153
+                }
152 154
                 if (is_null($type) && isset($m['type'])) {
153 155
                     $type = $m['type'];
154 156
                 }
@@ -307,8 +309,9 @@  discard block
 block discarded – undo
307 309
                 }
308 310
                 $lastPathParam = end($pathParams);
309 311
                 foreach ($pathParams as $position) {
310
-                    if (!empty($url))
311
-                        $url .= '/';
312
+                    if (!empty($url)) {
313
+                                            $url .= '/';
314
+                    }
312 315
                     $url .= '{' .
313 316
                         static::typeChar(isset($call['metadata']['param'][$position]['type'])
314 317
                             ? $call['metadata']['param'][$position]['type']
@@ -356,8 +359,9 @@  discard block
 block discarded – undo
356 359
         } else {
357 360
             static::$routes["v$version"][$path][$httpMethod] = $call;
358 361
             //create an alias with index if the method name is index
359
-            if ($call['methodName'] == 'index')
360
-                static::$routes["v$version"][ltrim("$path/index", '/')][$httpMethod] = $call;
362
+            if ($call['methodName'] == 'index') {
363
+                            static::$routes["v$version"][ltrim("$path/index", '/')][$httpMethod] = $call;
364
+            }
361 365
         }
362 366
     }
363 367
 
@@ -407,8 +411,9 @@  discard block
 block discarded – undo
407 411
         }
408 412
         //================== dynamic routes =============================
409 413
         //add newline char if trailing slash is found
410
-        if (substr($path, -1) == '/')
411
-            $path .= PHP_EOL;
414
+        if (substr($path, -1) == '/') {
415
+                    $path .= PHP_EOL;
416
+        }
412 417
         //if double slash is found fill in newline char;
413 418
         $path = str_replace('//', '/' . PHP_EOL . '/', $path);
414 419
         ksort($p);
@@ -474,8 +479,9 @@  discard block
 block discarded – undo
474 479
                     }
475 480
                     foreach ($excludedPaths as $exclude) {
476 481
                         if (empty($exclude)) {
477
-                            if ($fullPath == $exclude || $fullPath == 'index')
478
-                                continue 2;
482
+                            if ($fullPath == $exclude || $fullPath == 'index') {
483
+                                                            continue 2;
484
+                            }
479 485
                         } elseif (Text::beginsWith($fullPath, $exclude)) {
480 486
                             continue 2;
481 487
                         }
@@ -495,13 +501,15 @@  discard block
 block discarded – undo
495 501
 
496 502
     public static function verifyAccess($route)
497 503
     {
498
-        if ($route['accessLevel'] < 2)
499
-            return true;
504
+        if ($route['accessLevel'] < 2) {
505
+                    return true;
506
+        }
500 507
         /** @var Restler $r */
501 508
         $r = Scope::get('Restler');
502 509
         $authenticated = $r->_authenticated;
503
-        if (!$authenticated && $route['accessLevel'] > 1)
504
-            return false;
510
+        if (!$authenticated && $route['accessLevel'] > 1) {
511
+                    return false;
512
+        }
505 513
         if (
506 514
             $authenticated &&
507 515
             Defaults::$accessControlFunction &&
@@ -568,8 +576,9 @@  discard block
 block discarded – undo
568 576
         $modifier = "_modify_{$r->methodName}_api";
569 577
         if (method_exists($r->className, $modifier)) {
570 578
             $stage = end(Scope::get('Restler')->getEvents());
571
-            if (empty($stage))
572
-                $stage = 'setup';
579
+            if (empty($stage)) {
580
+                            $stage = 'setup';
581
+            }
573 582
             $r = Scope::get($r->className)->$modifier($r, $stage) ? : $r;
574 583
         }
575 584
         return $r;
@@ -758,10 +767,18 @@  discard block
 block discarded – undo
758 767
 
759 768
     public static function type($var)
760 769
     {
761
-        if (is_object($var)) return get_class($var);
762
-        if (is_array($var)) return 'array';
763
-        if (is_bool($var)) return 'boolean';
764
-        if (is_numeric($var)) return is_float($var) ? 'float' : 'int';
770
+        if (is_object($var)) {
771
+        	return get_class($var);
772
+        }
773
+        if (is_array($var)) {
774
+        	return 'array';
775
+        }
776
+        if (is_bool($var)) {
777
+        	return 'boolean';
778
+        }
779
+        if (is_numeric($var)) {
780
+        	return is_float($var) ? 'float' : 'int';
781
+        }
765 782
         return 'string';
766 783
     }
767 784
 
@@ -782,8 +799,9 @@  discard block
 block discarded – undo
782 799
                 if ($reading && ',' == $token) {
783 800
                     //===== STOP =====//
784 801
                     $reading = false;
785
-                    if (!empty($namespace))
786
-                        $imports[$alias] = trim($namespace, '\\');
802
+                    if (!empty($namespace)) {
803
+                                            $imports[$alias] = trim($namespace, '\\');
804
+                    }
787 805
                     //===== START =====//
788 806
                     $reading = true;
789 807
                     $namespace = '';
@@ -791,8 +809,9 @@  discard block
 block discarded – undo
791 809
                 } else {
792 810
                     //===== STOP =====//
793 811
                     $reading = false;
794
-                    if (!empty($namespace))
795
-                        $imports[$alias] = trim($namespace, '\\');
812
+                    if (!empty($namespace)) {
813
+                                            $imports[$alias] = trim($namespace, '\\');
814
+                    }
796 815
                 }
797 816
             } elseif (T_USE == $token[0]) {
798 817
                 //===== START =====//
Please login to merge, or discard this patch.