@@ -18,7 +18,7 @@ |
||
| 18 | 18 | return array( |
| 19 | 19 | self::DECIMAL => self::ARAB_DECIMAL, |
| 20 | 20 | self::GROUP => self::ARAB_GROUP, |
| 21 | - self::NEGATIVE => self::LTR_MARK . self::HYPHEN . self::LTR_MARK, |
|
| 21 | + self::NEGATIVE => self::LTR_MARK.self::HYPHEN.self::LTR_MARK, |
|
| 22 | 22 | ); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -28,30 +28,30 @@ discard block |
||
| 28 | 28 | $this->translations = array(); |
| 29 | 29 | |
| 30 | 30 | switch (strtolower(pathinfo($filename, PATHINFO_EXTENSION))) { |
| 31 | - case 'csv': |
|
| 32 | - $fp = fopen($filename, 'r'); |
|
| 33 | - if ($fp) { |
|
| 34 | - while (($data = fgetcsv($fp, 0, ';')) !== false) { |
|
| 35 | - $this->translations[$data[0]] = $data[1]; |
|
| 36 | - } |
|
| 37 | - fclose($fp); |
|
| 31 | + case 'csv': |
|
| 32 | + $fp = fopen($filename, 'r'); |
|
| 33 | + if ($fp) { |
|
| 34 | + while (($data = fgetcsv($fp, 0, ';')) !== false) { |
|
| 35 | + $this->translations[$data[0]] = $data[1]; |
|
| 38 | 36 | } |
| 39 | - break; |
|
| 37 | + fclose($fp); |
|
| 38 | + } |
|
| 39 | + break; |
|
| 40 | 40 | |
| 41 | - case 'mo': |
|
| 42 | - $fp = fopen($filename, 'rb'); |
|
| 43 | - if ($fp) { |
|
| 44 | - $this->readMoFile($fp); |
|
| 45 | - fclose($fp); |
|
| 46 | - } |
|
| 47 | - break; |
|
| 41 | + case 'mo': |
|
| 42 | + $fp = fopen($filename, 'rb'); |
|
| 43 | + if ($fp) { |
|
| 44 | + $this->readMoFile($fp); |
|
| 45 | + fclose($fp); |
|
| 46 | + } |
|
| 47 | + break; |
|
| 48 | 48 | |
| 49 | - case 'php': |
|
| 50 | - $translations = include $filename; |
|
| 51 | - if (is_array($translations)) { |
|
| 52 | - $this->translations = $translations; |
|
| 53 | - } |
|
| 54 | - break; |
|
| 49 | + case 'php': |
|
| 50 | + $translations = include $filename; |
|
| 51 | + if (is_array($translations)) { |
|
| 52 | + $this->translations = $translations; |
|
| 53 | + } |
|
| 54 | + break; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | $magic = $this->readMoWords($fp, 0, 1, self::PACK_LITTLE_ENDIAN); |
| 98 | 98 | |
| 99 | 99 | switch (dechex($magic[1])) { |
| 100 | - case self::MO_MAGIC_LITTLE_ENDIAN: |
|
| 101 | - $pack = self::PACK_LITTLE_ENDIAN; |
|
| 102 | - break; |
|
| 103 | - case self::MO_MAGIC_BIG_ENDIAN: |
|
| 104 | - $pack = self::PACK_BIG_ENDIAN; |
|
| 105 | - break; |
|
| 106 | - default: |
|
| 107 | - // Not a valid .MO file. |
|
| 108 | - throw new \InvalidArgumentException('Invalid .MO file'); |
|
| 100 | + case self::MO_MAGIC_LITTLE_ENDIAN: |
|
| 101 | + $pack = self::PACK_LITTLE_ENDIAN; |
|
| 102 | + break; |
|
| 103 | + case self::MO_MAGIC_BIG_ENDIAN: |
|
| 104 | + $pack = self::PACK_BIG_ENDIAN; |
|
| 105 | + break; |
|
| 106 | + default: |
|
| 107 | + // Not a valid .MO file. |
|
| 108 | + throw new \InvalidArgumentException('Invalid .MO file'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // Read the lookup tables |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | { |
| 80 | 80 | fseek($fp, $offset); |
| 81 | 81 | |
| 82 | - return unpack($pack . $count, fread($fp, $count * 4)); |
|
| 82 | + return unpack($pack.$count, fread($fp, $count * 4)); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function numberSymbols() |
| 25 | 25 | { |
| 26 | 26 | return array( |
| 27 | - self::NEGATIVE => self::LTR_MARK . self::HYPHEN, |
|
| 27 | + self::NEGATIVE => self::LTR_MARK.self::HYPHEN, |
|
| 28 | 28 | ); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -37,6 +37,6 @@ |
||
| 37 | 37 | |
| 38 | 38 | protected function percentFormat() |
| 39 | 39 | { |
| 40 | - return self::PERCENT . '%s'; |
|
| 40 | + return self::PERCENT.'%s'; |
|
| 41 | 41 | } |
| 42 | 42 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | public function endonym() |
| 13 | 13 | { |
| 14 | - if (get_class($this) === __NAMESPACE__ . '\LocaleZhHans') { |
|
| 14 | + if (get_class($this) === __NAMESPACE__.'\LocaleZhHans') { |
|
| 15 | 15 | // If the Hans script has been specified (but no other tags), then it is customary to include it. |
| 16 | 16 | return '简体中文'; |
| 17 | 17 | } else { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function languageTag() |
| 23 | 23 | { |
| 24 | - if (get_class($this) === __NAMESPACE__ . '\LocaleZhHans') { |
|
| 24 | + if (get_class($this) === __NAMESPACE__.'\LocaleZhHans') { |
|
| 25 | 25 | // If the Hans script has been specified (but no other tags), then it is customary to include it. |
| 26 | 26 | return 'zh-Hans'; |
| 27 | 27 | } else { |
@@ -37,6 +37,6 @@ |
||
| 37 | 37 | |
| 38 | 38 | protected function percentFormat() |
| 39 | 39 | { |
| 40 | - return self::PERCENT . self::NBSP . '%s'; |
|
| 40 | + return self::PERCENT.self::NBSP.'%s'; |
|
| 41 | 41 | } |
| 42 | 42 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function translateContext($context, $message) |
| 59 | 59 | { |
| 60 | - $key = $context . chr(4) . $message; |
|
| 60 | + $key = $context.chr(4).$message; |
|
| 61 | 61 | if (isset($this->translations[$key])) { |
| 62 | 62 | return $this->translations[$key]; |
| 63 | 63 | } else { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function translatePlural($message1, $message2, $number) |
| 79 | 79 | { |
| 80 | - $key = $message1 . chr(0) . $message2; |
|
| 80 | + $key = $message1.chr(0).$message2; |
|
| 81 | 81 | if (isset($this->translations[$key])) { |
| 82 | 82 | $plurals = explode(chr(0), $this->translations[$key]); |
| 83 | 83 | if (count($plurals) === $this->plural_rule->plurals()) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public static function create($code) |
| 37 | 37 | { |
| 38 | - $class = __NAMESPACE__ . '\Locale\Locale' . implode(array_map(function ($x) { |
|
| 38 | + $class = __NAMESPACE__.'\Locale\Locale'.implode(array_map(function($x) { |
|
| 39 | 39 | return ucfirst(strtolower($x)); |
| 40 | 40 | }, preg_split('/[^a-zA-Z0-9]+/', $code))); |
| 41 | 41 | |
@@ -60,18 +60,18 @@ discard block |
||
| 60 | 60 | if (!empty($server['HTTP_ACCEPT_LANGUAGE'])) { |
| 61 | 61 | $http_accept_language = strtolower(str_replace(' ', '', $server['HTTP_ACCEPT_LANGUAGE'])); |
| 62 | 62 | preg_match_all('/(?:([a-z][a-z0-9_-]+)(?:;q=([0-9.]+))?)/', $http_accept_language, $match); |
| 63 | - $preferences = array_map(function ($x) { |
|
| 63 | + $preferences = array_map(function($x) { |
|
| 64 | 64 | return $x === '' ? 1.0 : (float) $x; |
| 65 | 65 | }, array_combine($match[1], $match[2])); |
| 66 | 66 | |
| 67 | 67 | // Need a stable sort, as the original order is significant |
| 68 | - $preferences = array_map(function ($x) { |
|
| 68 | + $preferences = array_map(function($x) { |
|
| 69 | 69 | static $n = 0; |
| 70 | 70 | |
| 71 | 71 | return array($x, --$n); |
| 72 | 72 | }, $preferences); |
| 73 | 73 | arsort($preferences); |
| 74 | - $preferences = array_map(function ($x) { |
|
| 74 | + $preferences = array_map(function($x) { |
|
| 75 | 75 | return $x[0]; |
| 76 | 76 | }, $preferences); |
| 77 | 77 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function numberSymbols() |
| 25 | 25 | { |
| 26 | 26 | return array( |
| 27 | - self::NEGATIVE => self::LTR_MARK . self::HYPHEN, |
|
| 27 | + self::NEGATIVE => self::LTR_MARK.self::HYPHEN, |
|
| 28 | 28 | ); |
| 29 | 29 | } |
| 30 | 30 | } |