@@ -44,8 +44,9 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | //$output .= print_r($entry, true) . "\n"; |
| 46 | 46 | $output .= "\nFile: " . $entry['file'] . " (Line: " . $entry['line'] . ")\n"; |
| 47 | - if (isset($entry['class'])) |
|
| 48 | - $output .= $entry['class'] . "::"; |
|
| 47 | + if (isset($entry['class'])) { |
|
| 48 | + $output .= $entry['class'] . "::"; |
|
| 49 | + } |
|
| 49 | 50 | $output .= $entry['function'] |
| 50 | 51 | . "( " . json_encode($entry['args']) . " )\n"; |
| 51 | 52 | } |
@@ -73,8 +74,9 @@ discard block |
||
| 73 | 74 | function render($data, $shadow=true) |
| 74 | 75 | { |
| 75 | 76 | $r = ''; |
| 76 | - if (empty($data)) |
|
| 77 | - return $r; |
|
| 77 | + if (empty($data)) { |
|
| 78 | + return $r; |
|
| 79 | + } |
|
| 78 | 80 | $r .= $shadow ? "<ul class=\"shadow\">\n": "<ul>\n"; |
| 79 | 81 | if (is_array($data)) { |
| 80 | 82 | // field name |
@@ -112,8 +114,9 @@ discard block |
||
| 112 | 114 | $reqHeadersArr = array(); |
| 113 | 115 | $requestHeaders = $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . ' ' . $_SERVER['SERVER_PROTOCOL'] . PHP_EOL; |
| 114 | 116 | foreach ($reqHeadersArr as $key => $value) { |
| 115 | - if ($key == 'Host') |
|
| 116 | - continue; |
|
| 117 | + if ($key == 'Host') { |
|
| 118 | + continue; |
|
| 119 | + } |
|
| 117 | 120 | $requestHeaders .= "$key: $value" . PHP_EOL; |
| 118 | 121 | } |
| 119 | 122 | // $requestHeaders = $this->encode(apache_request_headers(), FALSE, |
@@ -353,7 +353,9 @@ |
||
| 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); |
@@ -243,7 +243,9 @@ |
||
| 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); |
@@ -55,8 +55,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -57,23 +57,26 @@ discard block |
||
| 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 |
||
| 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)) { |
@@ -25,8 +25,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -78,7 +78,9 @@ discard block |
||
| 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 |
||
| 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) |
@@ -106,8 +106,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -118,8 +118,9 @@ discard block |
||
| 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 |
||
| 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 | } |