@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @see FileHelper_FileFinder |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -declare(strict_types = 1); |
|
| 10 | +declare(strict_types=1); |
|
| 11 | 11 | |
| 12 | 12 | namespace AppUtils; |
| 13 | 13 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | public function getAll() : array |
| 127 | 127 | { |
| 128 | - if(!isset($this->found)) { |
|
| 128 | + if (!isset($this->found)) { |
|
| 129 | 129 | $this->find($this->path, true); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -150,25 +150,25 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | protected $found; |
| 152 | 152 | |
| 153 | - protected function find($path, $isRoot=false) |
|
| 153 | + protected function find($path, $isRoot = false) |
|
| 154 | 154 | { |
| 155 | - if($isRoot) { |
|
| 155 | + if ($isRoot) { |
|
| 156 | 156 | $this->found = array(); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $d = new \DirectoryIterator($path); |
| 160 | - foreach($d as $item) |
|
| 160 | + foreach ($d as $item) |
|
| 161 | 161 | { |
| 162 | - if($item->isDir()) |
|
| 162 | + if ($item->isDir()) |
|
| 163 | 163 | { |
| 164 | - if($this->getOption('recursive') === true && !$item->isDot()) { |
|
| 164 | + if ($this->getOption('recursive') === true && !$item->isDot()) { |
|
| 165 | 165 | $this->find($item->getPathname()); |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | else |
| 169 | 169 | { |
| 170 | 170 | $file = $this->filterFile($item->getPathname()); |
| 171 | - if($file) { |
|
| 171 | + if ($file) { |
|
| 172 | 172 | $this->found[] = $file; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -184,20 +184,20 @@ discard block |
||
| 184 | 184 | $include = $this->getOption('include-extensions'); |
| 185 | 185 | $exclude = $this->getOption('exclude-extensions'); |
| 186 | 186 | |
| 187 | - if(!empty($include)) |
|
| 187 | + if (!empty($include)) |
|
| 188 | 188 | { |
| 189 | - if(!in_array($info['extension'], $include)) { |
|
| 189 | + if (!in_array($info['extension'], $include)) { |
|
| 190 | 190 | return false; |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | - else if(!empty($exclude)) |
|
| 193 | + else if (!empty($exclude)) |
|
| 194 | 194 | { |
| 195 | - if(in_array($info['extension'], $exclude)) { |
|
| 195 | + if (in_array($info['extension'], $exclude)) { |
|
| 196 | 196 | return false; |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - switch($this->getOption('pathmode')) |
|
| 200 | + switch ($this->getOption('pathmode')) |
|
| 201 | 201 | { |
| 202 | 202 | case self::PATH_MODE_STRIP: |
| 203 | 203 | $path = basename($path); |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | break; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if($this->getOption('strip-extensions') === true) |
|
| 216 | + if ($this->getOption('strip-extensions') === true) |
|
| 217 | 217 | { |
| 218 | 218 | $path = str_replace('.'.$info['extension'], '', $path); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $replace = $this->getOption('slash-replacement'); |
| 222 | - if(!empty($replace)) { |
|
| 222 | + if (!empty($replace)) { |
|
| 223 | 223 | $path = str_replace('/', $replace, $path); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param int $code |
| 32 | 32 | * @param \Exception $previous |
| 33 | 33 | */ |
| 34 | - public function __construct(string $message, $details=null, $code=null, $previous=null) |
|
| 34 | + public function __construct(string $message, $details = null, $code = null, $previous = null) |
|
| 35 | 35 | { |
| 36 | 36 | parent::__construct($message, $code, $previous); |
| 37 | 37 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function getDetails() : string |
| 46 | 46 | { |
| 47 | - if($this->details !== null) { |
|
| 47 | + if ($this->details !== null) { |
|
| 48 | 48 | return $this->details; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function display() |
| 59 | 59 | { |
| 60 | - if(!headers_sent()) { |
|
| 60 | + if (!headers_sent()) { |
|
| 61 | 61 | header('Content-type:text/plain; charset=utf-8'); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | throw new BaseException(''); |
| 87 | 87 | } |
| 88 | - catch(BaseException $e) |
|
| 88 | + catch (BaseException $e) |
|
| 89 | 89 | { |
| 90 | 90 | echo self::createInfo($e)->toString(); |
| 91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | throw new BaseException(''); |
| 102 | 102 | } |
| 103 | - catch(BaseException $e) |
|
| 103 | + catch (BaseException $e) |
|
| 104 | 104 | { |
| 105 | 105 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
| 106 | 106 | echo self::createInfo($e)->toString(); |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $section = $this->addSection(self::SECTION_DEFAULT); |
| 37 | 37 | |
| 38 | - if(empty($iniString)) { |
|
| 38 | + if (empty($iniString)) { |
|
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $eol = ConvertHelper::detectEOLCharacter($iniString); |
| 43 | - if($eol !== null) { |
|
| 43 | + if ($eol !== null) { |
|
| 44 | 44 | $this->eol = $eol->getCharacter(); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $total = count($lines); |
| 50 | 50 | |
| 51 | - for($i=0; $i < $total; $i++) |
|
| 51 | + for ($i = 0; $i < $total; $i++) |
|
| 52 | 52 | { |
| 53 | 53 | $line = new IniHelper_Line($lines[$i], $i); |
| 54 | 54 | |
| 55 | - if($line->isSection()) { |
|
| 55 | + if ($line->isSection()) { |
|
| 56 | 56 | $section = $this->addSection($line->getSectionName()); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $iniPath = FileHelper::requireFileExists($iniPath); |
| 83 | 83 | |
| 84 | 84 | $content = file_get_contents($iniPath); |
| 85 | - if($content !== false) { |
|
| 85 | + if ($content !== false) { |
|
| 86 | 86 | return self::createFromString($content); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function addSection(string $name) : IniHelper_Section |
| 129 | 129 | { |
| 130 | - if(!isset($this->sections[$name])) { |
|
| 130 | + if (!isset($this->sections[$name])) { |
|
| 131 | 131 | $this->sections[$name] = new IniHelper_Section($this, $name); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function getSection(string $name) : ?IniHelper_Section |
| 144 | 144 | { |
| 145 | - if(isset($this->sections[$name])) { |
|
| 145 | + if (isset($this->sections[$name])) { |
|
| 146 | 146 | return $this->sections[$name]; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $result = array(); |
| 160 | 160 | |
| 161 | - foreach($this->sections as $section) |
|
| 161 | + foreach ($this->sections as $section) |
|
| 162 | 162 | { |
| 163 | - if($section->isDefault()) |
|
| 163 | + if ($section->isDefault()) |
|
| 164 | 164 | { |
| 165 | 165 | $result = array_merge($result, $section->toArray()); |
| 166 | 166 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | { |
| 201 | 201 | $parts = array(); |
| 202 | 202 | |
| 203 | - foreach($this->sections as $section) |
|
| 203 | + foreach ($this->sections as $section) |
|
| 204 | 204 | { |
| 205 | 205 | $parts[] = $section->toString(); |
| 206 | 206 | } |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function sectionExists(string $name) : bool |
| 245 | 245 | { |
| 246 | - foreach($this->sections as $section) { |
|
| 247 | - if($section->getName() === $name) { |
|
| 246 | + foreach ($this->sections as $section) { |
|
| 247 | + if ($section->getName() === $name) { |
|
| 248 | 248 | return true; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | { |
| 274 | 274 | $path = $this->parsePath($path); |
| 275 | 275 | |
| 276 | - if(!$this->sectionExists($path['section'])) { |
|
| 276 | + if (!$this->sectionExists($path['section'])) { |
|
| 277 | 277 | return array(); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | { |
| 285 | 285 | $path = explode($this->pathSeparator, $path); |
| 286 | 286 | |
| 287 | - if(count($path) === 1) |
|
| 287 | + if (count($path) === 1) |
|
| 288 | 288 | { |
| 289 | 289 | return array( |
| 290 | 290 | 'section' => self::SECTION_DEFAULT, |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | $quoteStyle = array_shift($params); |
| 96 | 96 | $method = array_shift($params); |
| 97 | 97 | |
| 98 | - $call = $method . '('; |
|
| 98 | + $call = $method.'('; |
|
| 99 | 99 | |
| 100 | 100 | $total = count($params); |
| 101 | - if($total > 0) { |
|
| 102 | - for($i=0; $i < $total; $i++) |
|
| 101 | + if ($total > 0) { |
|
| 102 | + for ($i = 0; $i < $total; $i++) |
|
| 103 | 103 | { |
| 104 | 104 | $call .= self::phpVariable2JS($params[$i], $quoteStyle); |
| 105 | - if($i < ($total-1)) { |
|
| 105 | + if ($i < ($total - 1)) { |
|
| 106 | 106 | $call .= ','; |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - return $call . ');'; |
|
| 111 | + return $call.');'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public static function buildVariable(string $varName, $varValue) : string |
| 134 | 134 | { |
| 135 | - return $varName . "=" . self::phpVariable2JS($varValue) . ';'; |
|
| 135 | + return $varName."=".self::phpVariable2JS($varValue).';'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @param int $quoteStyle The quote style to use for strings |
| 145 | 145 | * @return string |
| 146 | 146 | */ |
| 147 | - public static function phpVariable2JS($variable, int $quoteStyle=self::QUOTE_STYLE_DOUBLE) : string |
|
| 147 | + public static function phpVariable2JS($variable, int $quoteStyle = self::QUOTE_STYLE_DOUBLE) : string |
|
| 148 | 148 | { |
| 149 | 149 | // after much profiling, this variant of the method offers |
| 150 | 150 | // the best performance. Repeat scalar values are cached |
@@ -152,22 +152,22 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $type = gettype($variable); |
| 154 | 154 | $hash = null; |
| 155 | - if(is_scalar($variable) === true) |
|
| 155 | + if (is_scalar($variable) === true) |
|
| 156 | 156 | { |
| 157 | 157 | $hash = $variable; |
| 158 | 158 | |
| 159 | - if($hash === true) |
|
| 159 | + if ($hash === true) |
|
| 160 | 160 | { |
| 161 | 161 | $hash = 'true'; |
| 162 | 162 | } |
| 163 | - else if($hash === false) |
|
| 163 | + else if ($hash === false) |
|
| 164 | 164 | { |
| 165 | 165 | $hash = 'false'; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $hash .= '-'.$quoteStyle.'-'.$type; |
| 169 | 169 | |
| 170 | - if(isset(self::$variableCache[$hash])) { |
|
| 170 | + if (isset(self::$variableCache[$hash])) { |
|
| 171 | 171 | return self::$variableCache[$hash]; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -175,19 +175,19 @@ discard block |
||
| 175 | 175 | $result = 'null'; |
| 176 | 176 | |
| 177 | 177 | // one gettype call is better than a strict if-else. |
| 178 | - switch($type) |
|
| 178 | + switch ($type) |
|
| 179 | 179 | { |
| 180 | 180 | case 'double': |
| 181 | 181 | case 'string': |
| 182 | 182 | $string = json_encode($variable); |
| 183 | 183 | |
| 184 | - if($string === false) |
|
| 184 | + if ($string === false) |
|
| 185 | 185 | { |
| 186 | 186 | $string = ''; |
| 187 | 187 | } |
| 188 | - else if($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
| 188 | + else if ($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
| 189 | 189 | { |
| 190 | - $string = mb_substr($string, 1, mb_strlen($string)-2); |
|
| 190 | + $string = mb_substr($string, 1, mb_strlen($string) - 2); |
|
| 191 | 191 | $string = "'".str_replace("'", "\'", $string)."'"; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | break; |
| 196 | 196 | |
| 197 | 197 | case 'boolean': |
| 198 | - if($variable === true) { |
|
| 198 | + if ($variable === true) { |
|
| 199 | 199 | $result = 'true'; |
| 200 | 200 | } else { |
| 201 | 201 | $result = 'false'; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // cache cacheable values |
| 216 | - if($hash !== null) |
|
| 216 | + if ($hash !== null) |
|
| 217 | 217 | { |
| 218 | 218 | self::$variableCache[$hash] = $result; |
| 219 | 219 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | self::$elementCounter++; |
| 247 | 247 | |
| 248 | - return self::$idPrefix . self::$elementCounter; |
|
| 248 | + return self::$idPrefix.self::$elementCounter; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @see JSHelper::JS_REGEX_OBJECT |
| 320 | 320 | * @see JSHelper::JS_REGEX_JSON |
| 321 | 321 | */ |
| 322 | - public static function buildRegexStatement(string $regex, string $statementType=self::JS_REGEX_OBJECT) : string |
|
| 322 | + public static function buildRegexStatement(string $regex, string $statementType = self::JS_REGEX_OBJECT) : string |
|
| 323 | 323 | { |
| 324 | 324 | $regex = trim($regex); |
| 325 | 325 | $separator = substr($regex, 0, 1); |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | array_shift($parts); |
| 328 | 328 | |
| 329 | 329 | $modifiers = array_pop($parts); |
| 330 | - if($modifiers == $separator) { |
|
| 330 | + if ($modifiers == $separator) { |
|
| 331 | 331 | $modifiers = ''; |
| 332 | 332 | } |
| 333 | 333 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | // convert the anchors that are not supported in js regexes |
| 344 | 344 | $format = str_replace(array('\\A', '\\Z', '\\z'), array('^', '$', ''), $format); |
| 345 | 345 | |
| 346 | - if($statementType==self::JS_REGEX_JSON) |
|
| 346 | + if ($statementType == self::JS_REGEX_JSON) |
|
| 347 | 347 | { |
| 348 | 348 | return ConvertHelper::var2json(array( |
| 349 | 349 | 'format' => $format, |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | )); |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - if(!empty($modifiers)) { |
|
| 354 | + if (!empty($modifiers)) { |
|
| 355 | 355 | return sprintf( |
| 356 | 356 | 'new RegExp(%s, %s)', |
| 357 | 357 | ConvertHelper::var2json($format), |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function setOption(string $name, $value) |
| 43 | 43 | { |
| 44 | - if(!isset($this->options)) { |
|
| 44 | + if (!isset($this->options)) { |
|
| 45 | 45 | $this->options = $this->getDefaultOptions(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function setOptions(array $options) |
| 60 | 60 | { |
| 61 | - foreach($options as $name => $value) { |
|
| 61 | + foreach ($options as $name => $value) { |
|
| 62 | 62 | $this->setOption($name, $value); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | * @param mixed $default The default value to return if the option does not exist. |
| 76 | 76 | * @return mixed |
| 77 | 77 | */ |
| 78 | - public function getOption(string $name, $default=null) |
|
| 78 | + public function getOption(string $name, $default = null) |
|
| 79 | 79 | { |
| 80 | - if(!isset($this->options)) { |
|
| 80 | + if (!isset($this->options)) { |
|
| 81 | 81 | $this->options = $this->getDefaultOptions(); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if(isset($this->options[$name])) { |
|
| 84 | + if (isset($this->options[$name])) { |
|
| 85 | 85 | return $this->options[$name]; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * @param string $default Used if the option does not exist, is invalid, or empty. |
| 99 | 99 | * @return string |
| 100 | 100 | */ |
| 101 | - public function getStringOption(string $name, string $default='') : string |
|
| 101 | + public function getStringOption(string $name, string $default = '') : string |
|
| 102 | 102 | { |
| 103 | 103 | $value = $this->getOption($name, false); |
| 104 | 104 | |
| 105 | - if((is_string($value) || is_numeric($value)) && !empty($value)) { |
|
| 105 | + if ((is_string($value) || is_numeric($value)) && !empty($value)) { |
|
| 106 | 106 | return (string)$value; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | * @param string $name |
| 119 | 119 | * @return bool |
| 120 | 120 | */ |
| 121 | - public function getBoolOption(string $name, bool $default=false) : bool |
|
| 121 | + public function getBoolOption(string $name, bool $default = false) : bool |
|
| 122 | 122 | { |
| 123 | - if($this->getOption($name) === true) { |
|
| 123 | + if ($this->getOption($name) === true) { |
|
| 124 | 124 | return true; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | * @param int $default |
| 137 | 137 | * @return int |
| 138 | 138 | */ |
| 139 | - public function getIntOption(string $name, int $default=0) : int |
|
| 139 | + public function getIntOption(string $name, int $default = 0) : int |
|
| 140 | 140 | { |
| 141 | 141 | $value = $this->getOption($name); |
| 142 | - if(ConvertHelper::isInteger($value)) { |
|
| 142 | + if (ConvertHelper::isInteger($value)) { |
|
| 143 | 143 | return (int)$value; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function getArrayOption(string $name) : array |
| 158 | 158 | { |
| 159 | 159 | $val = $this->getOption($name); |
| 160 | - if(is_array($val)) { |
|
| 160 | + if (is_array($val)) { |
|
| 161 | 161 | return $val; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function hasOption(string $name) : bool |
| 175 | 175 | { |
| 176 | - if(!isset($this->options)) { |
|
| 176 | + if (!isset($this->options)) { |
|
| 177 | 177 | $this->options = $this->getDefaultOptions(); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function getOptions() : array |
| 188 | 188 | { |
| 189 | - if(!isset($this->options)) { |
|
| 189 | + if (!isset($this->options)) { |
|
| 190 | 190 | $this->options = $this->getDefaultOptions(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @param mixed $default |
| 241 | 241 | * @return Interface_Optionable |
| 242 | 242 | */ |
| 243 | - function getOption(string $name, $default=null); |
|
| 243 | + function getOption(string $name, $default = null); |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * @param array $options |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // extract parameter names from the query string |
| 38 | 38 | $result = array(); |
| 39 | 39 | preg_match_all('/&?([^&]+)=.*/sixU', $queryString, $result, PREG_PATTERN_ORDER); |
| 40 | - if(isset($result[1])) { |
|
| 40 | + if (isset($result[1])) { |
|
| 41 | 41 | $paramNames = $result[1]; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | // possible naming conflicts like having both parameters "foo.bar" |
| 61 | 61 | // and "foo_bar" in the query string: since "foo.bar" would be converted |
| 62 | 62 | // to "foo_bar", one of the two would be replaced. |
| 63 | - if($fixRequired) |
|
| 63 | + if ($fixRequired) |
|
| 64 | 64 | { |
| 65 | 65 | $counter = 1; |
| 66 | 66 | $placeholders = array(); |
| 67 | - foreach($paramNames as $paramName) |
|
| 67 | + foreach ($paramNames as $paramName) |
|
| 68 | 68 | { |
| 69 | 69 | // create a unique placeholder name |
| 70 | 70 | $placeholder = '__PLACEHOLDER'.$counter.'__'; |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | parse_str($queryString, $parsed); |
| 95 | 95 | |
| 96 | 96 | // do any of the parameter names need to be fixed? |
| 97 | - if(!$fixRequired) { |
|
| 97 | + if (!$fixRequired) { |
|
| 98 | 98 | return $parsed; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $keep = array(); |
| 102 | 102 | |
| 103 | - foreach($parsed as $name => $value) |
|
| 103 | + foreach ($parsed as $name => $value) |
|
| 104 | 104 | { |
| 105 | 105 | $keep[$table[$name]] = $value; |
| 106 | 106 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | return $this->getBoolOption('cut'); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function setCuttingEnabled(bool $enabled=true) : ConvertHelper_WordWrapper |
|
| 66 | + public function setCuttingEnabled(bool $enabled = true) : ConvertHelper_WordWrapper |
|
| 67 | 67 | { |
| 68 | 68 | $this->setOption('cut', $enabled); |
| 69 | 69 | return $this; |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | $interval = $d2->diff($d1); |
| 59 | 59 | |
| 60 | - if($interval === false) |
|
| 60 | + if ($interval === false) |
|
| 61 | 61 | { |
| 62 | 62 | throw new ConvertHelper_Exception( |
| 63 | 63 | 'Cannot create interval', |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function __construct() |
| 65 | 65 | { |
| 66 | - if(class_exists('\AppLocalize\Localization')) { |
|
| 66 | + if (class_exists('\AppLocalize\Localization')) { |
|
| 67 | 67 | \AppLocalize\Localization::onLocaleChanged(array($this, 'handle_localeChanged')); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $epoch = 'past'; |
| 127 | 127 | $key = 'singular'; |
| 128 | - if($this->dateDiff > 1) { |
|
| 128 | + if ($this->dateDiff > 1) { |
|
| 129 | 129 | $key = 'plural'; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if($this->future) { |
|
| 132 | + if ($this->future) { |
|
| 133 | 133 | $epoch = 'future'; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | protected function initTexts() |
| 144 | 144 | { |
| 145 | - if(isset(self::$texts)) { |
|
| 145 | + if (isset(self::$texts)) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $day = (int)date("j", $this->dateTo); |
| 229 | 229 | $year = (int)date("Y", $this->dateFrom); |
| 230 | 230 | |
| 231 | - while(mktime($hour, $min, $sec, $month + ($months_difference), $day, $year) < $this->dateTo) |
|
| 231 | + while (mktime($hour, $min, $sec, $month + ($months_difference), $day, $year) < $this->dateTo) |
|
| 232 | 232 | { |
| 233 | 233 | $months_difference++; |
| 234 | 234 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | protected function resolveCalculations() : void |
| 250 | 250 | { |
| 251 | - if(!isset($this->dateFrom)) |
|
| 251 | + if (!isset($this->dateFrom)) |
|
| 252 | 252 | { |
| 253 | 253 | throw new ConvertHelper_Exception( |
| 254 | 254 | 'No date from has been specified.', |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | // no date to set? Assume we want to use today. |
| 261 | - if(!isset($this->dateTo)) |
|
| 261 | + if (!isset($this->dateTo)) |
|
| 262 | 262 | { |
| 263 | 263 | $this->dateTo = time(); |
| 264 | 264 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | $difference = $this->dateTo - $this->dateFrom; |
| 339 | 339 | |
| 340 | - if($difference < 0) |
|
| 340 | + if ($difference < 0) |
|
| 341 | 341 | { |
| 342 | 342 | $difference = $difference * -1; |
| 343 | 343 | $this->future = true; |