@@ -49,31 +49,31 @@ discard block |
||
| 49 | 49 | * Parent instance containing data |
| 50 | 50 | * @var CultureInfo |
| 51 | 51 | */ |
| 52 | - private $cultureInfo = array(); |
|
| 52 | + private $cultureInfo=array(); |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * ICU number formatting data. |
| 56 | 56 | * @var array |
| 57 | 57 | */ |
| 58 | - private $data = array(); |
|
| 58 | + private $data=array(); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * A list of properties that are accessable/writable. |
| 62 | 62 | * @var array |
| 63 | 63 | */ |
| 64 | - protected $properties = array(); |
|
| 64 | + protected $properties=array(); |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * The number pattern. |
| 68 | 68 | * @var array |
| 69 | 69 | */ |
| 70 | - protected $pattern = array(); |
|
| 70 | + protected $pattern=array(); |
|
| 71 | 71 | |
| 72 | - const DECIMAL = 'decimalFormat'; |
|
| 73 | - const CURRENCY = 'currencyFormat'; |
|
| 74 | - const PERCENTAGE = 'percentFormat'; |
|
| 75 | - const SCIENTIFIC = 'scientificFormat'; |
|
| 76 | - const ACCOUNTING = 'accountingFormat'; |
|
| 72 | + const DECIMAL='decimalFormat'; |
|
| 73 | + const CURRENCY='currencyFormat'; |
|
| 74 | + const PERCENTAGE='percentFormat'; |
|
| 75 | + const SCIENTIFIC='scientificFormat'; |
|
| 76 | + const ACCOUNTING='accountingFormat'; |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Allow functions that begins with 'set' to be called directly |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function __get($name) |
| 84 | 84 | { |
| 85 | - $getProperty = 'get'.$name; |
|
| 85 | + $getProperty='get'.$name; |
|
| 86 | 86 | if(in_array($getProperty, $this->properties)) |
| 87 | 87 | return $this->$getProperty(); |
| 88 | 88 | else |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function __set($name, $value) |
| 97 | 97 | { |
| 98 | - $setProperty = 'set'.$name; |
|
| 98 | + $setProperty='set'.$name; |
|
| 99 | 99 | if(in_array($setProperty, $this->properties)) |
| 100 | 100 | $this->$setProperty($value); |
| 101 | 101 | else |
@@ -111,27 +111,27 @@ discard block |
||
| 111 | 111 | * @param array ICU data for date time formatting. |
| 112 | 112 | * @see getInstance() |
| 113 | 113 | */ |
| 114 | - public function __construct($cultureInfo, $type = NumberFormatInfo::DECIMAL) |
|
| 114 | + public function __construct($cultureInfo, $type=NumberFormatInfo::DECIMAL) |
|
| 115 | 115 | { |
| 116 | - $this->properties = get_class_methods($this); |
|
| 116 | + $this->properties=get_class_methods($this); |
|
| 117 | 117 | |
| 118 | 118 | if(!($cultureInfo instanceof CultureInfo)) |
| 119 | 119 | throw new Exception('Please provide a CultureInfo instance.'); |
| 120 | 120 | |
| 121 | - $this->cultureInfo = $cultureInfo; |
|
| 121 | + $this->cultureInfo=$cultureInfo; |
|
| 122 | 122 | |
| 123 | 123 | $this->setPattern($type); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | public function getInfoByPath($path) |
| 127 | 127 | { |
| 128 | - static $basePath = null; |
|
| 129 | - if($basePath === null) |
|
| 128 | + static $basePath=null; |
|
| 129 | + if($basePath===null) |
|
| 130 | 130 | { |
| 131 | - $basePath = 'NumberElements/' . $this->cultureInfo->getDefaultNumberFormat() . '/'; |
|
| 131 | + $basePath='NumberElements/'.$this->cultureInfo->getDefaultNumberFormat().'/'; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - return $this->cultureInfo->findInfo($basePath . $path); |
|
| 134 | + return $this->cultureInfo->findInfo($basePath.$path); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | * NumberFormatInfo::ACCOUNTING |
| 142 | 142 | * @param int pattern type. |
| 143 | 143 | */ |
| 144 | - public function setPattern($type = NumberFormatInfo::DECIMAL) |
|
| 144 | + public function setPattern($type=NumberFormatInfo::DECIMAL) |
|
| 145 | 145 | { |
| 146 | - $info = $this->getInfoByPath('patterns/'.$type); |
|
| 147 | - $this->pattern = $this->parsePattern($info); |
|
| 146 | + $info=$this->getInfoByPath('patterns/'.$type); |
|
| 147 | + $this->pattern=$this->parsePattern($info); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function getPattern() |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | public static function getInvariantInfo($type=NumberFormatInfo::DECIMAL) |
| 161 | 161 | { |
| 162 | 162 | static $invariant; |
| 163 | - if($invariant === null) |
|
| 163 | + if($invariant===null) |
|
| 164 | 164 | { |
| 165 | - $culture = CultureInfo::getInvariantCulture(); |
|
| 166 | - $invariant = $culture->NumberFormat; |
|
| 165 | + $culture=CultureInfo::getInvariantCulture(); |
|
| 166 | + $invariant=$culture->NumberFormat; |
|
| 167 | 167 | $invariant->setPattern($type); |
| 168 | 168 | } |
| 169 | 169 | return $invariant; |
@@ -183,19 +183,19 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public static function getInstance($culture=null, $type=NumberFormatInfo::DECIMAL) |
| 185 | 185 | { |
| 186 | - if ($culture instanceof CultureInfo) |
|
| 186 | + if($culture instanceof CultureInfo) |
|
| 187 | 187 | { |
| 188 | - $formatInfo = $culture->NumberFormat; |
|
| 188 | + $formatInfo=$culture->NumberFormat; |
|
| 189 | 189 | $formatInfo->setPattern($type); |
| 190 | 190 | return $formatInfo; |
| 191 | 191 | } elseif(is_string($culture)) { |
| 192 | - $cultureInfo = new CultureInfo($culture); |
|
| 193 | - $formatInfo = $cultureInfo->NumberFormat; |
|
| 192 | + $cultureInfo=new CultureInfo($culture); |
|
| 193 | + $formatInfo=$cultureInfo->NumberFormat; |
|
| 194 | 194 | $formatInfo->setPattern($type); |
| 195 | 195 | return $formatInfo; |
| 196 | 196 | } else { |
| 197 | - $cultureInfo = new CultureInfo(); |
|
| 198 | - $formatInfo = $cultureInfo->NumberFormat; |
|
| 197 | + $cultureInfo=new CultureInfo(); |
|
| 198 | + $formatInfo=$cultureInfo->NumberFormat; |
|
| 199 | 199 | $formatInfo->setPattern($type); |
| 200 | 200 | return $formatInfo; |
| 201 | 201 | } |
@@ -241,67 +241,67 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | protected function parsePattern($pattern) |
| 243 | 243 | { |
| 244 | - $pattern = explode(';',$pattern); |
|
| 244 | + $pattern=explode(';', $pattern); |
|
| 245 | 245 | |
| 246 | - $negative = null; |
|
| 246 | + $negative=null; |
|
| 247 | 247 | if(count($pattern) > 1) |
| 248 | - $negative = $pattern[1]; |
|
| 249 | - $pattern = $pattern[0]; |
|
| 248 | + $negative=$pattern[1]; |
|
| 249 | + $pattern=$pattern[0]; |
|
| 250 | 250 | |
| 251 | - $comma = ','; |
|
| 252 | - $dot = '.'; |
|
| 253 | - $digit = '0'; |
|
| 254 | - $hash = '#'; |
|
| 251 | + $comma=','; |
|
| 252 | + $dot='.'; |
|
| 253 | + $digit='0'; |
|
| 254 | + $hash='#'; |
|
| 255 | 255 | |
| 256 | 256 | //find the first group point, and decimal point |
| 257 | - $groupPos1 = strrpos($pattern,$comma); |
|
| 258 | - $decimalPos = strrpos($pattern,$dot); |
|
| 257 | + $groupPos1=strrpos($pattern, $comma); |
|
| 258 | + $decimalPos=strrpos($pattern, $dot); |
|
| 259 | 259 | |
| 260 | - $groupPos2 = false; |
|
| 261 | - $groupSize1 = false; |
|
| 262 | - $groupSize2 = false; |
|
| 263 | - $decimalPoints = is_int($decimalPos)?-1:false; |
|
| 260 | + $groupPos2=false; |
|
| 261 | + $groupSize1=false; |
|
| 262 | + $groupSize2=false; |
|
| 263 | + $decimalPoints=is_int($decimalPos) ?-1 : false; |
|
| 264 | 264 | |
| 265 | - $info['negPref'] = $this->getNegativeSign(); |
|
| 266 | - $info['negPost'] = ''; |
|
| 265 | + $info['negPref']=$this->getNegativeSign(); |
|
| 266 | + $info['negPost']=''; |
|
| 267 | 267 | |
| 268 | - $info['negative'] = $negative; |
|
| 269 | - $info['positive'] = $pattern; |
|
| 268 | + $info['negative']=$negative; |
|
| 269 | + $info['positive']=$pattern; |
|
| 270 | 270 | |
| 271 | 271 | //find the negative prefix and postfix |
| 272 | 272 | if($negative) |
| 273 | 273 | { |
| 274 | - $prefixPostfix = $this->getPrePostfix($negative); |
|
| 275 | - $info['negPref'] = $prefixPostfix[0]; |
|
| 276 | - $info['negPost'] = $prefixPostfix[1]; |
|
| 274 | + $prefixPostfix=$this->getPrePostfix($negative); |
|
| 275 | + $info['negPref']=$prefixPostfix[0]; |
|
| 276 | + $info['negPost']=$prefixPostfix[1]; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $posfix = $this->getPrePostfix($pattern); |
|
| 280 | - $info['posPref'] = $posfix[0]; |
|
| 281 | - $info['posPost'] = $posfix[1]; |
|
| 279 | + $posfix=$this->getPrePostfix($pattern); |
|
| 280 | + $info['posPref']=$posfix[0]; |
|
| 281 | + $info['posPost']=$posfix[1]; |
|
| 282 | 282 | |
| 283 | 283 | //var_dump($pattern); |
| 284 | 284 | //var_dump($decimalPos); |
| 285 | 285 | if(is_int($groupPos1)) |
| 286 | 286 | { |
| 287 | 287 | //get the second group |
| 288 | - $groupPos2 = strrpos(substr($pattern,0,$groupPos1),$comma); |
|
| 288 | + $groupPos2=strrpos(substr($pattern, 0, $groupPos1), $comma); |
|
| 289 | 289 | |
| 290 | 290 | //get the number of decimal digits |
| 291 | 291 | if(is_int($decimalPos)) |
| 292 | 292 | { |
| 293 | - $groupSize1 = $decimalPos - $groupPos1-1; |
|
| 293 | + $groupSize1=$decimalPos - $groupPos1 - 1; |
|
| 294 | 294 | |
| 295 | 295 | } |
| 296 | 296 | else |
| 297 | 297 | { |
| 298 | 298 | //no decimal point, so traverse from the back |
| 299 | 299 | //to find the groupsize 1. |
| 300 | - for($i=strlen($pattern)-1; $i>=0; $i--) |
|
| 300 | + for($i=strlen($pattern) - 1; $i >= 0; $i--) |
|
| 301 | 301 | { |
| 302 | - if($pattern{$i} == $digit || $pattern{$i}==$hash) |
|
| 302 | + if($pattern{$i}==$digit || $pattern{$i}==$hash) |
|
| 303 | 303 | { |
| 304 | - $groupSize1 = $i - $groupPos1; |
|
| 304 | + $groupSize1=$i - $groupPos1; |
|
| 305 | 305 | break; |
| 306 | 306 | } |
| 307 | 307 | } |
@@ -309,36 +309,36 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | //get the second group size |
| 311 | 311 | if(is_int($groupPos2)) |
| 312 | - $groupSize2 = $groupPos1 - $groupPos2-1; |
|
| 312 | + $groupSize2=$groupPos1 - $groupPos2 - 1; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | if(is_int($decimalPos)) |
| 316 | 316 | { |
| 317 | - for($i=strlen($pattern)-1; $i>=0; $i--) |
|
| 317 | + for($i=strlen($pattern) - 1; $i >= 0; $i--) |
|
| 318 | 318 | { |
| 319 | - if($pattern{$i} == $dot) break; |
|
| 320 | - if($pattern{$i} == $digit) |
|
| 319 | + if($pattern{$i}==$dot) break; |
|
| 320 | + if($pattern{$i}==$digit) |
|
| 321 | 321 | { |
| 322 | - $decimalPoints = $i - $decimalPos; |
|
| 322 | + $decimalPoints=$i - $decimalPos; |
|
| 323 | 323 | break; |
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | if(is_int($decimalPos)) |
| 329 | - $digitPattern = substr($pattern,0,$decimalPos); |
|
| 329 | + $digitPattern=substr($pattern, 0, $decimalPos); |
|
| 330 | 330 | else |
| 331 | - $digitPattern = $pattern; |
|
| 331 | + $digitPattern=$pattern; |
|
| 332 | 332 | |
| 333 | - $digitPattern = preg_replace('/[^0]/','',$digitPattern); |
|
| 333 | + $digitPattern=preg_replace('/[^0]/', '', $digitPattern); |
|
| 334 | 334 | |
| 335 | - $info['groupPos1'] = $groupPos1; |
|
| 336 | - $info['groupSize1'] = $groupSize1; |
|
| 337 | - $info['groupPos2'] = $groupPos2; |
|
| 338 | - $info['groupSize2'] = $groupSize2; |
|
| 339 | - $info['decimalPos'] = $decimalPos; |
|
| 340 | - $info['decimalPoints'] = $decimalPoints; |
|
| 341 | - $info['digitSize'] = strlen($digitPattern); |
|
| 335 | + $info['groupPos1']=$groupPos1; |
|
| 336 | + $info['groupSize1']=$groupSize1; |
|
| 337 | + $info['groupPos2']=$groupPos2; |
|
| 338 | + $info['groupSize2']=$groupSize2; |
|
| 339 | + $info['decimalPos']=$decimalPos; |
|
| 340 | + $info['decimalPoints']=$decimalPoints; |
|
| 341 | + $info['digitSize']=strlen($digitPattern); |
|
| 342 | 342 | |
| 343 | 343 | return $info; |
| 344 | 344 | } |
@@ -350,9 +350,9 @@ discard block |
||
| 350 | 350 | */ |
| 351 | 351 | protected function getPrePostfix($pattern) |
| 352 | 352 | { |
| 353 | - $regexp = '/[#,\.0]+/'; |
|
| 354 | - $result = preg_split($regexp, $pattern); |
|
| 355 | - return array($result[0],$result[1]); |
|
| 353 | + $regexp='/[#,\.0]+/'; |
|
| 354 | + $result=preg_split($regexp, $pattern); |
|
| 355 | + return array($result[0], $result[1]); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -398,8 +398,8 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | public function getGroupSizes() |
| 400 | 400 | { |
| 401 | - $group1 = $this->pattern['groupSize1']; |
|
| 402 | - $group2 = $this->pattern['groupSize2']; |
|
| 401 | + $group1=$this->pattern['groupSize1']; |
|
| 402 | + $group2=$this->pattern['groupSize2']; |
|
| 403 | 403 | |
| 404 | 404 | return array($group1, $group2); |
| 405 | 405 | } |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | */ |
| 413 | 413 | public function getNegativePattern() |
| 414 | 414 | { |
| 415 | - $prefix = $this->pattern['negPref']; |
|
| 416 | - $postfix = $this->pattern['negPost']; |
|
| 415 | + $prefix=$this->pattern['negPref']; |
|
| 416 | + $postfix=$this->pattern['negPost']; |
|
| 417 | 417 | return array($prefix, $postfix); |
| 418 | 418 | } |
| 419 | 419 | |
@@ -425,8 +425,8 @@ discard block |
||
| 425 | 425 | */ |
| 426 | 426 | public function getPositivePattern() |
| 427 | 427 | { |
| 428 | - $prefix = $this->pattern['posPref']; |
|
| 429 | - $postfix = $this->pattern['posPost']; |
|
| 428 | + $prefix=$this->pattern['posPref']; |
|
| 429 | + $postfix=$this->pattern['posPost']; |
|
| 430 | 430 | return array($prefix, $postfix); |
| 431 | 431 | } |
| 432 | 432 | |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | public function getNegativeInfinitySymbol() |
| 438 | 438 | { |
| 439 | - return $this->getNegativeSign() . $this->getInfoByPath('symbols/infinity'); |
|
| 439 | + return $this->getNegativeSign().$this->getInfoByPath('symbols/infinity'); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | public function getPositiveInfinitySymbol() |
| 447 | 447 | { |
| 448 | - return $this->getPositiveSign() . $this->getInfoByPath('symbols/infinity'); |
|
| 448 | + return $this->getPositiveSign().$this->getInfoByPath('symbols/infinity'); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | */ |
| 500 | 500 | public function getCurrencySymbol($currency='USD') |
| 501 | 501 | { |
| 502 | - $fmt = new \NumberFormatter( $this->cultureInfo->getName()."@currency=$currency", \NumberFormatter::CURRENCY ); |
|
| 502 | + $fmt=new \NumberFormatter($this->cultureInfo->getName()."@currency=$currency", \NumberFormatter::CURRENCY); |
|
| 503 | 503 | return $fmt->getSymbol(\NumberFormatter::CURRENCY_SYMBOL); |
| 504 | 504 | } |
| 505 | 505 | } |
@@ -46,42 +46,42 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function getLanguages() |
| 48 | 48 | { |
| 49 | - if($this->languages !== null) { |
|
| 49 | + if($this->languages!==null) { |
|
| 50 | 50 | return $this->languages; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $this->languages = array(); |
|
| 53 | + $this->languages=array(); |
|
| 54 | 54 | |
| 55 | - if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
| 55 | + if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
| 56 | 56 | return $this->languages; |
| 57 | 57 | |
| 58 | - $info = new CultureInfo(); |
|
| 58 | + $info=new CultureInfo(); |
|
| 59 | 59 | |
| 60 | 60 | foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) |
| 61 | 61 | { |
| 62 | 62 | // Cut off any q-value that might come after a semi-colon |
| 63 | - if ($pos = strpos($lang, ';')) |
|
| 64 | - $lang = trim(substr($lang, 0, $pos)); |
|
| 63 | + if($pos=strpos($lang, ';')) |
|
| 64 | + $lang=trim(substr($lang, 0, $pos)); |
|
| 65 | 65 | |
| 66 | - if (strstr($lang, '-')) |
|
| 66 | + if(strstr($lang, '-')) |
|
| 67 | 67 | { |
| 68 | - $codes = explode('-',$lang); |
|
| 69 | - if($codes[0] == 'i') |
|
| 68 | + $codes=explode('-', $lang); |
|
| 69 | + if($codes[0]=='i') |
|
| 70 | 70 | { |
| 71 | 71 | // Language not listed in ISO 639 that are not variants |
| 72 | 72 | // of any listed language, which can be registerd with the |
| 73 | 73 | // i-prefix, such as i-cherokee |
| 74 | - if(count($codes)>1) |
|
| 75 | - $lang = $codes[1]; |
|
| 74 | + if(count($codes) > 1) |
|
| 75 | + $lang=$codes[1]; |
|
| 76 | 76 | } |
| 77 | 77 | else |
| 78 | 78 | { |
| 79 | - for($i = 0, $k = count($codes); $i<$k; ++$i) |
|
| 79 | + for($i=0, $k=count($codes); $i < $k; ++$i) |
|
| 80 | 80 | { |
| 81 | - if($i == 0) |
|
| 82 | - $lang = strtolower($codes[0]); |
|
| 81 | + if($i==0) |
|
| 82 | + $lang=strtolower($codes[0]); |
|
| 83 | 83 | else |
| 84 | - $lang .= '_'.strtoupper($codes[$i]); |
|
| 84 | + $lang.='_'.strtoupper($codes[$i]); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | if($info->validCulture($lang)) |
| 92 | - $this->languages[] = $lang; |
|
| 92 | + $this->languages[]=$lang; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return $this->languages; |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | function getCharsets() |
| 103 | 103 | { |
| 104 | - if($this->charsets !== null) { |
|
| 104 | + if($this->charsets!==null) { |
|
| 105 | 105 | return $this->charsets; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $this->charsets = array(); |
|
| 108 | + $this->charsets=array(); |
|
| 109 | 109 | |
| 110 | - if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) |
|
| 110 | + if(!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) |
|
| 111 | 111 | return $this->charsets; |
| 112 | 112 | |
| 113 | - foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) |
|
| 113 | + foreach(explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) |
|
| 114 | 114 | { |
| 115 | - if (!empty($charset)) |
|
| 116 | - $this->charsets[] = preg_replace('/;.*/', '', $charset); |
|
| 115 | + if(!empty($charset)) |
|
| 116 | + $this->charsets[]=preg_replace('/;.*/', '', $charset); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return $this->charsets; |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | * Parent instance containing data |
| 80 | 80 | * @var CultureInfo |
| 81 | 81 | */ |
| 82 | - private $cultureInfo = array(); |
|
| 82 | + private $cultureInfo=array(); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * A list of properties that are accessable/writable. |
| 86 | 86 | * @var array |
| 87 | 87 | */ |
| 88 | - protected $properties = array(); |
|
| 88 | + protected $properties=array(); |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Allow functions that begins with 'set' to be called directly |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function __get($name) |
| 96 | 96 | { |
| 97 | - $getProperty = 'get'.$name; |
|
| 97 | + $getProperty='get'.$name; |
|
| 98 | 98 | if(in_array($getProperty, $this->properties)) |
| 99 | 99 | return $this->$getProperty(); |
| 100 | 100 | else |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function __set($name, $value) |
| 109 | 109 | { |
| 110 | - $setProperty = 'set'.$name; |
|
| 110 | + $setProperty='set'.$name; |
|
| 111 | 111 | if(in_array($setProperty, $this->properties)) |
| 112 | 112 | $this->$setProperty($value); |
| 113 | 113 | else |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function __construct($cultureInfo) |
| 127 | 127 | { |
| 128 | - $this->properties = get_class_methods($this); |
|
| 128 | + $this->properties=get_class_methods($this); |
|
| 129 | 129 | |
| 130 | 130 | if(!($cultureInfo instanceof CultureInfo)) |
| 131 | 131 | throw new Exception('Please provide a CultureInfo instance.'); |
| 132 | 132 | |
| 133 | - $this->cultureInfo = $cultureInfo; |
|
| 133 | + $this->cultureInfo=$cultureInfo; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | static public function getInvariantInfo() |
| 142 | 142 | { |
| 143 | 143 | static $invariant; |
| 144 | - if($invariant === null) |
|
| 144 | + if($invariant===null) |
|
| 145 | 145 | { |
| 146 | - $culture = CultureInfo::getInvariantCulture(); |
|
| 147 | - $invariant = $culture->getDateTimeFormat(); |
|
| 146 | + $culture=CultureInfo::getInvariantCulture(); |
|
| 147 | + $invariant=$culture->getDateTimeFormat(); |
|
| 148 | 148 | } |
| 149 | 149 | return $invariant; |
| 150 | 150 | } |
@@ -158,27 +158,27 @@ discard block |
||
| 158 | 158 | static public function getInstance($culture=null) |
| 159 | 159 | { |
| 160 | 160 | |
| 161 | - if ($culture instanceof CultureInfo) |
|
| 161 | + if($culture instanceof CultureInfo) |
|
| 162 | 162 | { |
| 163 | 163 | return $culture->getDateTimeFormat(); |
| 164 | 164 | } elseif(is_string($culture)) { |
| 165 | - $cultureInfo = CultureInfo::getInstance($culture); |
|
| 165 | + $cultureInfo=CultureInfo::getInstance($culture); |
|
| 166 | 166 | return $cultureInfo->getDateTimeFormat(); |
| 167 | 167 | } else { |
| 168 | - $cultureInfo = CultureInfo::getInvariantCulture(); |
|
| 168 | + $cultureInfo=CultureInfo::getInvariantCulture(); |
|
| 169 | 169 | return $cultureInfo->getDateTimeFormat(); |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public function getInfoByPath($path) |
| 174 | 174 | { |
| 175 | - static $basePath = null; |
|
| 176 | - if($basePath === null) |
|
| 175 | + static $basePath=null; |
|
| 176 | + if($basePath===null) |
|
| 177 | 177 | { |
| 178 | - $basePath = 'calendar/' . $this->cultureInfo->getCalendar() . '/'; |
|
| 178 | + $basePath='calendar/'.$this->cultureInfo->getCalendar().'/'; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - return $this->cultureInfo->findInfo($basePath . $path); |
|
| 181 | + return $this->cultureInfo->findInfo($basePath.$path); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function getAbbreviatedMonthNames() |
| 241 | 241 | { |
| 242 | - $info = $this->getInfoByPath('monthNames/format/abbreviated'); |
|
| 243 | - if ($info) |
|
| 242 | + $info=$this->getInfoByPath('monthNames/format/abbreviated'); |
|
| 243 | + if($info) |
|
| 244 | 244 | return $info; |
| 245 | 245 | else |
| 246 | 246 | return $this->getMonthNames(); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function getEra($era) |
| 268 | 268 | { |
| 269 | - $eraName = $this->getInfoByPath('eras/abbreviated'); |
|
| 269 | + $eraName=$this->getInfoByPath('eras/abbreviated'); |
|
| 270 | 270 | return $eraName[$era]; |
| 271 | 271 | } |
| 272 | 272 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function getAMDesignator() |
| 279 | 279 | { |
| 280 | - $result = $this->getAMPMMarkers(); |
|
| 280 | + $result=$this->getAMPMMarkers(); |
|
| 281 | 281 | return $result[0]; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function getPMDesignator() |
| 290 | 290 | { |
| 291 | - $result = $this->getAMPMMarkers(); |
|
| 291 | + $result=$this->getAMPMMarkers(); |
|
| 292 | 292 | return $result[1]; |
| 293 | 293 | } |
| 294 | 294 | |
@@ -399,8 +399,8 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | public function formatDateTime($date, $time) |
| 401 | 401 | { |
| 402 | - $pattern = $this->getDateTimeOrderPattern(); |
|
| 403 | - return str_replace(array('{0}','{1}'), array($time, $date), $pattern); |
|
| 402 | + $pattern=$this->getDateTimeOrderPattern(); |
|
| 403 | + return str_replace(array('{0}', '{1}'), array($time, $date), $pattern); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * The ICU data array. |
| 57 | 57 | * @var array |
| 58 | 58 | */ |
| 59 | - private $data = array(); |
|
| 59 | + private $data=array(); |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * The current culture. |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * A list of CLDR resource bundles loaded |
| 69 | 69 | * @var array |
| 70 | 70 | */ |
| 71 | - private $resourceBundles = array(); |
|
| 71 | + private $resourceBundles=array(); |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * A list of resource bundles keys |
| 75 | 75 | * @var array |
| 76 | 76 | */ |
| 77 | - protected static $bundleNames = array( |
|
| 77 | + protected static $bundleNames=array( |
|
| 78 | 78 | 'Core' => null, |
| 79 | 79 | 'Currencies' => 'ICUDATA-curr', |
| 80 | 80 | 'Languages' => 'ICUDATA-lang', |
@@ -98,28 +98,28 @@ discard block |
||
| 98 | 98 | * A list of properties that are accessable/writable. |
| 99 | 99 | * @var array |
| 100 | 100 | */ |
| 101 | - protected $properties = array(); |
|
| 101 | + protected $properties=array(); |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Culture type, all. |
| 105 | 105 | * @see getCultures() |
| 106 | 106 | * @var int |
| 107 | 107 | */ |
| 108 | - const ALL = 0; |
|
| 108 | + const ALL=0; |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * Culture type, neutral. |
| 112 | 112 | * @see getCultures() |
| 113 | 113 | * @var int |
| 114 | 114 | */ |
| 115 | - const NEUTRAL = 1; |
|
| 115 | + const NEUTRAL=1; |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * Culture type, specific. |
| 119 | 119 | * @see getCultures() |
| 120 | 120 | * @var int |
| 121 | 121 | */ |
| 122 | - const SPECIFIC = 2; |
|
| 122 | + const SPECIFIC=2; |
|
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * Display the culture name. |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | function __get($name) |
| 141 | 141 | { |
| 142 | - $getProperty = 'get'.$name; |
|
| 142 | + $getProperty='get'.$name; |
|
| 143 | 143 | if(in_array($getProperty, $this->properties)) |
| 144 | 144 | return $this->$getProperty(); |
| 145 | 145 | else |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | function __set($name, $value) |
| 154 | 154 | { |
| 155 | - $setProperty = 'set'.$name; |
|
| 155 | + $setProperty='set'.$name; |
|
| 156 | 156 | if(in_array($setProperty, $this->properties)) |
| 157 | 157 | $this->$setProperty($value); |
| 158 | 158 | else |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | function __construct($culture='en') |
| 172 | 172 | { |
| 173 | - $this->properties = get_class_methods($this); |
|
| 173 | + $this->properties=get_class_methods($this); |
|
| 174 | 174 | |
| 175 | 175 | if(empty($culture)) |
| 176 | - $culture = 'en'; |
|
| 176 | + $culture='en'; |
|
| 177 | 177 | |
| 178 | 178 | $this->setCulture($culture); |
| 179 | 179 | |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public static function getInstance($culture) |
| 189 | 189 | { |
| 190 | - static $instances = array(); |
|
| 190 | + static $instances=array(); |
|
| 191 | 191 | if(!isset($instances[$culture])) |
| 192 | - $instances[$culture] = new CultureInfo($culture); |
|
| 192 | + $instances[$culture]=new CultureInfo($culture); |
|
| 193 | 193 | return $instances[$culture]; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | { |
| 214 | 214 | if(!empty($culture)) |
| 215 | 215 | { |
| 216 | - if (!preg_match('/^[_\\w]+$/', $culture)) |
|
| 217 | - throw new Exception('Invalid culture supplied: ' . $culture); |
|
| 216 | + if(!preg_match('/^[_\\w]+$/', $culture)) |
|
| 217 | + throw new Exception('Invalid culture supplied: '.$culture); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $this->culture = $culture; |
|
| 220 | + $this->culture=$culture; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -226,20 +226,20 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | protected function loadCultureData($cultureName) |
| 228 | 228 | { |
| 229 | - $culture_parts = explode('_', $cultureName); |
|
| 230 | - $current_part = $culture_parts[0]; |
|
| 229 | + $culture_parts=explode('_', $cultureName); |
|
| 230 | + $current_part=$culture_parts[0]; |
|
| 231 | 231 | |
| 232 | - $culturesToLoad = array($current_part); |
|
| 233 | - for($i = 1, $k = count($culture_parts); $i < $k; ++$i) |
|
| 232 | + $culturesToLoad=array($current_part); |
|
| 233 | + for($i=1, $k=count($culture_parts); $i < $k; ++$i) |
|
| 234 | 234 | { |
| 235 | - $current_part .= '_'.$culture_parts[$i]; |
|
| 236 | - $culturesToLoad[] = $current_part; |
|
| 235 | + $current_part.='_'.$culture_parts[$i]; |
|
| 236 | + $culturesToLoad[]=$current_part; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | foreach(self::$bundleNames as $key => $bundleName) |
| 240 | 240 | { |
| 241 | 241 | if(!array_key_exists($key, $this->data)) |
| 242 | - $this->data[$key] = array(); |
|
| 242 | + $this->data[$key]=array(); |
|
| 243 | 243 | } |
| 244 | 244 | foreach($culturesToLoad as $culture) |
| 245 | 245 | { |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | array_unshift($this->resourceBundles, $culture); |
| 250 | 250 | foreach(self::$bundleNames as $key => $bundleName) |
| 251 | 251 | { |
| 252 | - $this->data[$key][$culture] = \ResourceBundle::create($culture, $bundleName, false); |
|
| 252 | + $this->data[$key][$culture]=\ResourceBundle::create($culture, $bundleName, false); |
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -268,19 +268,19 @@ discard block |
||
| 268 | 268 | * @param boolean merge the data from its parents. |
| 269 | 269 | * @return mixed the specific ICU data. |
| 270 | 270 | */ |
| 271 | - public function findInfo($path='/', $merge=false, $key = null) |
|
| 271 | + public function findInfo($path='/', $merge=false, $key=null) |
|
| 272 | 272 | { |
| 273 | - $result = array(); |
|
| 273 | + $result=array(); |
|
| 274 | 274 | |
| 275 | - if($key === null) |
|
| 275 | + if($key===null) |
|
| 276 | 276 | { |
| 277 | 277 | // try to guess the bundle from the path. Always defaults to "Core". |
| 278 | - $key = 'Core'; |
|
| 278 | + $key='Core'; |
|
| 279 | 279 | foreach(self::$bundleNames as $bundleName => $icuBundleName) |
| 280 | 280 | { |
| 281 | - if(strpos($path, $bundleName) === 0) |
|
| 281 | + if(strpos($path, $bundleName)===0) |
|
| 282 | 282 | { |
| 283 | - $key = $bundleName; |
|
| 283 | + $key=$bundleName; |
|
| 284 | 284 | break; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -290,14 +290,14 @@ discard block |
||
| 290 | 290 | return $result; |
| 291 | 291 | foreach($this->resourceBundles as $culture) |
| 292 | 292 | { |
| 293 | - $res = $this->data[$key][$culture]; |
|
| 294 | - if($res === null) |
|
| 293 | + $res=$this->data[$key][$culture]; |
|
| 294 | + if($res===null) |
|
| 295 | 295 | continue; |
| 296 | - $info = $this->searchResources($res, $path); |
|
| 296 | + $info=$this->searchResources($res, $path); |
|
| 297 | 297 | if($info) |
| 298 | 298 | { |
| 299 | 299 | if($merge) |
| 300 | - $result = array_merge($result, $info); |
|
| 300 | + $result=array_merge($result, $info); |
|
| 301 | 301 | else |
| 302 | 302 | return $info; |
| 303 | 303 | } |
@@ -316,14 +316,14 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | private function searchResources($info, $path='/') |
| 318 | 318 | { |
| 319 | - $index = explode('/',$path); |
|
| 319 | + $index=explode('/', $path); |
|
| 320 | 320 | |
| 321 | - $resource = $info; |
|
| 322 | - for($i = 0, $k = count($index); $i < $k; ++$i) |
|
| 321 | + $resource=$info; |
|
| 322 | + for($i=0, $k=count($index); $i < $k; ++$i) |
|
| 323 | 323 | { |
| 324 | 324 | |
| 325 | - $resource = $resource->get($index[$i], false); |
|
| 326 | - if($resource === null) |
|
| 325 | + $resource=$resource->get($index[$i], false); |
|
| 326 | + if($resource===null) |
|
| 327 | 327 | return null; |
| 328 | 328 | } |
| 329 | 329 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | public function getDateTimeFormat() |
| 349 | 349 | { |
| 350 | - if($this->dateTimeFormat === null) |
|
| 350 | + if($this->dateTimeFormat===null) |
|
| 351 | 351 | { |
| 352 | 352 | $this->setDateTimeFormat(new DateTimeFormatInfo($this)); |
| 353 | 353 | } |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | public function setDateTimeFormat($dateTimeFormat) |
| 363 | 363 | { |
| 364 | - $this->dateTimeFormat = $dateTimeFormat; |
|
| 364 | + $this->dateTimeFormat=$dateTimeFormat; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
@@ -381,10 +381,10 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | public function getNativeName() |
| 383 | 383 | { |
| 384 | - $lang = substr($this->culture,0,2); |
|
| 385 | - $reg = substr($this->culture,3,2); |
|
| 386 | - $language = $this->findInfo("Languages/{$lang}"); |
|
| 387 | - $region = $this->findInfo("Countries/{$reg}"); |
|
| 384 | + $lang=substr($this->culture, 0, 2); |
|
| 385 | + $reg=substr($this->culture, 3, 2); |
|
| 386 | + $language=$this->findInfo("Languages/{$lang}"); |
|
| 387 | + $region=$this->findInfo("Countries/{$reg}"); |
|
| 388 | 388 | if($region) |
| 389 | 389 | return $language.' ('.$region.')'; |
| 390 | 390 | else |
@@ -399,15 +399,15 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | public function getEnglishName() |
| 401 | 401 | { |
| 402 | - $lang = substr($this->culture,0,2); |
|
| 403 | - $reg = substr($this->culture,3,2); |
|
| 404 | - $culture = $this->getInvariantCulture(); |
|
| 402 | + $lang=substr($this->culture, 0, 2); |
|
| 403 | + $reg=substr($this->culture, 3, 2); |
|
| 404 | + $culture=$this->getInvariantCulture(); |
|
| 405 | 405 | |
| 406 | - $language = $culture->findInfo("Languages/{$lang}"); |
|
| 407 | - if(count($language) == 0) |
|
| 406 | + $language=$culture->findInfo("Languages/{$lang}"); |
|
| 407 | + if(count($language)==0) |
|
| 408 | 408 | return $this->culture; |
| 409 | 409 | |
| 410 | - $region = $culture->findInfo("Countries/{$reg}"); |
|
| 410 | + $region=$culture->findInfo("Countries/{$reg}"); |
|
| 411 | 411 | if($region) |
| 412 | 412 | return $language.' ('.$region.')'; |
| 413 | 413 | else |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | static public function getInvariantCulture() |
| 425 | 425 | { |
| 426 | 426 | static $invariant; |
| 427 | - if($invariant === null) |
|
| 428 | - $invariant = new CultureInfo(); |
|
| 427 | + if($invariant===null) |
|
| 428 | + $invariant=new CultureInfo(); |
|
| 429 | 429 | return $invariant; |
| 430 | 430 | } |
| 431 | 431 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | public function getIsNeutralCulture() |
| 439 | 439 | { |
| 440 | - return strlen($this->culture) == 2; |
|
| 440 | + return strlen($this->culture)==2; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | /** |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function getNumberFormat() |
| 449 | 449 | { |
| 450 | - if($this->numberFormat === null) |
|
| 450 | + if($this->numberFormat===null) |
|
| 451 | 451 | { |
| 452 | 452 | $this->setNumberFormat(new NumberFormatInfo($this)); |
| 453 | 453 | } |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | public function setNumberFormat($numberFormat) |
| 462 | 462 | { |
| 463 | - $this->numberFormat = $numberFormat; |
|
| 463 | + $this->numberFormat=$numberFormat; |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | /** |
@@ -479,10 +479,10 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | public function getParent() |
| 481 | 481 | { |
| 482 | - if(strlen($this->culture) == 2) |
|
| 482 | + if(strlen($this->culture)==2) |
|
| 483 | 483 | return $this->getInvariantCulture(); |
| 484 | 484 | |
| 485 | - $lang = substr($this->culture,0,2); |
|
| 485 | + $lang=substr($this->culture, 0, 2); |
|
| 486 | 486 | return new CultureInfo($lang); |
| 487 | 487 | } |
| 488 | 488 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | */ |
| 498 | 498 | static public function getCultures($type=CultureInfo::ALL) |
| 499 | 499 | { |
| 500 | - $all = \ResourceBundle::getLocales(''); |
|
| 500 | + $all=\ResourceBundle::getLocales(''); |
|
| 501 | 501 | |
| 502 | 502 | switch($type) |
| 503 | 503 | { |
@@ -506,14 +506,14 @@ discard block |
||
| 506 | 506 | case CultureInfo::NEUTRAL : |
| 507 | 507 | foreach($all as $key => $culture) |
| 508 | 508 | { |
| 509 | - if(strlen($culture) != 2) |
|
| 509 | + if(strlen($culture)!=2) |
|
| 510 | 510 | unset($all[$key]); |
| 511 | 511 | } |
| 512 | 512 | return $all; |
| 513 | 513 | case CultureInfo::SPECIFIC : |
| 514 | 514 | foreach($all as $key => $culture) |
| 515 | 515 | { |
| 516 | - if(strlen($culture) == 2) |
|
| 516 | + if(strlen($culture)==2) |
|
| 517 | 517 | unset($all[$key]); |
| 518 | 518 | } |
| 519 | 519 | return $all; |
@@ -532,19 +532,19 @@ discard block |
||
| 532 | 532 | if(is_scalar($obj)) { |
| 533 | 533 | return $obj; |
| 534 | 534 | } elseif($obj instanceof \ResourceBundle) { |
| 535 | - $array = array(); |
|
| 535 | + $array=array(); |
|
| 536 | 536 | foreach($obj as $k => $v) |
| 537 | - $array[$k] = $v; |
|
| 537 | + $array[$k]=$v; |
|
| 538 | 538 | } else { |
| 539 | - $array = $obj; |
|
| 539 | + $array=$obj; |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - for($i = 0, $k = count($array); $i<$k; ++$i) |
|
| 542 | + for($i=0, $k=count($array); $i < $k; ++$i) |
|
| 543 | 543 | { |
| 544 | - $key = key($array); |
|
| 544 | + $key=key($array); |
|
| 545 | 545 | if(is_array($array[$key]) |
| 546 | - && count($array[$key]) == 1) |
|
| 547 | - $array[$key] = $array[$key][0]; |
|
| 546 | + && count($array[$key])==1) |
|
| 547 | + $array[$key]=$array[$key][0]; |
|
| 548 | 548 | next($array); |
| 549 | 549 | } |
| 550 | 550 | return $array; |
@@ -566,11 +566,11 @@ discard block |
||
| 566 | 566 | public function getCurrencies() |
| 567 | 567 | { |
| 568 | 568 | static $arr; |
| 569 | - if($arr === null) |
|
| 569 | + if($arr===null) |
|
| 570 | 570 | { |
| 571 | - $arr = $this->findInfo('Currencies', true, 'Currencies'); |
|
| 571 | + $arr=$this->findInfo('Currencies', true, 'Currencies'); |
|
| 572 | 572 | foreach($arr as $k => $v) |
| 573 | - $arr[$k] = $this->simplify($v); |
|
| 573 | + $arr[$k]=$this->simplify($v); |
|
| 574 | 574 | } |
| 575 | 575 | return $arr; |
| 576 | 576 | } |
@@ -600,17 +600,17 @@ discard block |
||
| 600 | 600 | public function getTimeZones() |
| 601 | 601 | { |
| 602 | 602 | static $arr; |
| 603 | - if($arr === null) |
|
| 603 | + if($arr===null) |
|
| 604 | 604 | { |
| 605 | - $validPrefixes = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Etc', 'Europe', 'Indian', 'Pacific'); |
|
| 606 | - $tmp = $this->findInfo('zoneStrings', true, 'zoneStrings'); |
|
| 605 | + $validPrefixes=array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Etc', 'Europe', 'Indian', 'Pacific'); |
|
| 606 | + $tmp=$this->findInfo('zoneStrings', true, 'zoneStrings'); |
|
| 607 | 607 | foreach($tmp as $k => $v) |
| 608 | 608 | { |
| 609 | 609 | foreach($validPrefixes as $prefix) |
| 610 | 610 | { |
| 611 | - if(strpos($k, $prefix) === 0) |
|
| 611 | + if(strpos($k, $prefix)===0) |
|
| 612 | 612 | { |
| 613 | - $arr[] = str_replace(':', '/', $k); |
|
| 613 | + $arr[]=str_replace(':', '/', $k); |
|
| 614 | 614 | break; |
| 615 | 615 | } |
| 616 | 616 | } |