@@ -9,8 +9,8 @@ |
||
9 | 9 | */ |
10 | 10 | class TerritoryHt extends AbstractTerritory implements TerritoryInterface |
11 | 11 | { |
12 | - public function code() |
|
13 | - { |
|
14 | - return 'HT'; |
|
15 | - } |
|
12 | + public function code() |
|
13 | + { |
|
14 | + return 'HT'; |
|
15 | + } |
|
16 | 16 | } |
@@ -9,23 +9,23 @@ |
||
9 | 9 | */ |
10 | 10 | class TerritoryPr extends AbstractTerritory implements TerritoryInterface |
11 | 11 | { |
12 | - public function code() |
|
13 | - { |
|
14 | - return 'PR'; |
|
15 | - } |
|
12 | + public function code() |
|
13 | + { |
|
14 | + return 'PR'; |
|
15 | + } |
|
16 | 16 | |
17 | - public function firstDay() |
|
18 | - { |
|
19 | - return 0; |
|
20 | - } |
|
17 | + public function firstDay() |
|
18 | + { |
|
19 | + return 0; |
|
20 | + } |
|
21 | 21 | |
22 | - public function measurementSystem() |
|
23 | - { |
|
24 | - return 'US'; |
|
25 | - } |
|
22 | + public function measurementSystem() |
|
23 | + { |
|
24 | + return 'US'; |
|
25 | + } |
|
26 | 26 | |
27 | - public function paperSize() |
|
28 | - { |
|
29 | - return 'US-Letter'; |
|
30 | - } |
|
27 | + public function paperSize() |
|
28 | + { |
|
29 | + return 'US-Letter'; |
|
30 | + } |
|
31 | 31 | } |
@@ -9,13 +9,13 @@ |
||
9 | 9 | */ |
10 | 10 | class TerritoryLr extends AbstractTerritory implements TerritoryInterface |
11 | 11 | { |
12 | - public function code() |
|
13 | - { |
|
14 | - return 'LR'; |
|
15 | - } |
|
12 | + public function code() |
|
13 | + { |
|
14 | + return 'LR'; |
|
15 | + } |
|
16 | 16 | |
17 | - public function measurementSystem() |
|
18 | - { |
|
19 | - return 'US'; |
|
20 | - } |
|
17 | + public function measurementSystem() |
|
18 | + { |
|
19 | + return 'US'; |
|
20 | + } |
|
21 | 21 | } |
@@ -9,23 +9,23 @@ |
||
9 | 9 | */ |
10 | 10 | class TerritoryLy extends AbstractTerritory implements TerritoryInterface |
11 | 11 | { |
12 | - public function code() |
|
13 | - { |
|
14 | - return 'LY'; |
|
15 | - } |
|
12 | + public function code() |
|
13 | + { |
|
14 | + return 'LY'; |
|
15 | + } |
|
16 | 16 | |
17 | - public function firstDay() |
|
18 | - { |
|
19 | - return 6; |
|
20 | - } |
|
17 | + public function firstDay() |
|
18 | + { |
|
19 | + return 6; |
|
20 | + } |
|
21 | 21 | |
22 | - public function weekendStart() |
|
23 | - { |
|
24 | - return 5; |
|
25 | - } |
|
22 | + public function weekendStart() |
|
23 | + { |
|
24 | + return 5; |
|
25 | + } |
|
26 | 26 | |
27 | - public function weekendEnd() |
|
28 | - { |
|
29 | - return 6; |
|
30 | - } |
|
27 | + public function weekendEnd() |
|
28 | + { |
|
29 | + return 6; |
|
30 | + } |
|
31 | 31 | } |
@@ -9,8 +9,8 @@ |
||
9 | 9 | */ |
10 | 10 | class Territory002 extends AbstractTerritory implements TerritoryInterface |
11 | 11 | { |
12 | - public function code() |
|
13 | - { |
|
14 | - return '002'; |
|
15 | - } |
|
12 | + public function code() |
|
13 | + { |
|
14 | + return '002'; |
|
15 | + } |
|
16 | 16 | } |
@@ -9,117 +9,117 @@ |
||
9 | 9 | */ |
10 | 10 | class Translation |
11 | 11 | { |
12 | - // Constants for processing .MO files |
|
13 | - const MO_MAGIC_LITTLE_ENDIAN = '950412de'; |
|
14 | - const MO_MAGIC_BIG_ENDIAN = 'de120495'; |
|
15 | - const PACK_LITTLE_ENDIAN = 'V'; |
|
16 | - const PACK_BIG_ENDIAN = 'N'; |
|
12 | + // Constants for processing .MO files |
|
13 | + const MO_MAGIC_LITTLE_ENDIAN = '950412de'; |
|
14 | + const MO_MAGIC_BIG_ENDIAN = 'de120495'; |
|
15 | + const PACK_LITTLE_ENDIAN = 'V'; |
|
16 | + const PACK_BIG_ENDIAN = 'N'; |
|
17 | 17 | |
18 | - /** @var array An association of English -> translated messages */ |
|
19 | - private $translations; |
|
18 | + /** @var array An association of English -> translated messages */ |
|
19 | + private $translations; |
|
20 | 20 | |
21 | - /** |
|
22 | - * The code for this variant. |
|
23 | - * |
|
24 | - * @param string $filename |
|
25 | - */ |
|
26 | - public function __construct($filename) |
|
27 | - { |
|
28 | - $this->translations = array(); |
|
21 | + /** |
|
22 | + * The code for this variant. |
|
23 | + * |
|
24 | + * @param string $filename |
|
25 | + */ |
|
26 | + public function __construct($filename) |
|
27 | + { |
|
28 | + $this->translations = array(); |
|
29 | 29 | |
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); |
|
38 | - } |
|
39 | - break; |
|
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); |
|
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; |
|
55 | - } |
|
56 | - } |
|
49 | + case 'php': |
|
50 | + $translations = include $filename; |
|
51 | + if (is_array($translations)) { |
|
52 | + $this->translations = $translations; |
|
53 | + } |
|
54 | + break; |
|
55 | + } |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * The translation strings |
|
60 | - * |
|
61 | - * @return array |
|
62 | - */ |
|
63 | - public function asArray() |
|
64 | - { |
|
65 | - return $this->translations; |
|
66 | - } |
|
58 | + /** |
|
59 | + * The translation strings |
|
60 | + * |
|
61 | + * @return array |
|
62 | + */ |
|
63 | + public function asArray() |
|
64 | + { |
|
65 | + return $this->translations; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Read specific binary data (32 bit words) from a .MO file |
|
70 | - * |
|
71 | - * @param resource $fp |
|
72 | - * @param int $offset |
|
73 | - * @param int $count |
|
74 | - * @param string $pack "N" for big-endian, "V" for little-endian |
|
75 | - * |
|
76 | - * @return int[] |
|
77 | - */ |
|
78 | - private function readMoWords($fp, $offset, $count, $pack) |
|
79 | - { |
|
80 | - fseek($fp, $offset); |
|
68 | + /** |
|
69 | + * Read specific binary data (32 bit words) from a .MO file |
|
70 | + * |
|
71 | + * @param resource $fp |
|
72 | + * @param int $offset |
|
73 | + * @param int $count |
|
74 | + * @param string $pack "N" for big-endian, "V" for little-endian |
|
75 | + * |
|
76 | + * @return int[] |
|
77 | + */ |
|
78 | + private function readMoWords($fp, $offset, $count, $pack) |
|
79 | + { |
|
80 | + fseek($fp, $offset); |
|
81 | 81 | |
82 | - return unpack($pack . $count, fread($fp, $count * 4)); |
|
83 | - } |
|
82 | + return unpack($pack . $count, fread($fp, $count * 4)); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Read and parse a .MO (gettext) file |
|
87 | - * |
|
88 | - * @link https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html |
|
89 | - * |
|
90 | - * @param resource $fp |
|
91 | - * |
|
92 | - * @return void |
|
93 | - */ |
|
94 | - private function readMoFile($fp) |
|
95 | - { |
|
96 | - // How is the numeric data packed in the .MO file? |
|
97 | - $magic = $this->readMoWords($fp, 0, 1, self::PACK_LITTLE_ENDIAN); |
|
85 | + /** |
|
86 | + * Read and parse a .MO (gettext) file |
|
87 | + * |
|
88 | + * @link https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html |
|
89 | + * |
|
90 | + * @param resource $fp |
|
91 | + * |
|
92 | + * @return void |
|
93 | + */ |
|
94 | + private function readMoFile($fp) |
|
95 | + { |
|
96 | + // How is the numeric data packed in the .MO file? |
|
97 | + $magic = $this->readMoWords($fp, 0, 1, self::PACK_LITTLE_ENDIAN); |
|
98 | 98 | |
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'); |
|
109 | - } |
|
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'); |
|
109 | + } |
|
110 | 110 | |
111 | - // Read the lookup tables |
|
112 | - list(, $number_of_strings, $offset_original, $offset_translated) = $this->readMoWords($fp, 8, 3, $pack); |
|
113 | - $lookup_original = $this->readMoWords($fp, $offset_original, $number_of_strings * 2, $pack); |
|
114 | - $lookup_translated = $this->readMoWords($fp, $offset_translated, $number_of_strings * 2, $pack); |
|
111 | + // Read the lookup tables |
|
112 | + list(, $number_of_strings, $offset_original, $offset_translated) = $this->readMoWords($fp, 8, 3, $pack); |
|
113 | + $lookup_original = $this->readMoWords($fp, $offset_original, $number_of_strings * 2, $pack); |
|
114 | + $lookup_translated = $this->readMoWords($fp, $offset_translated, $number_of_strings * 2, $pack); |
|
115 | 115 | |
116 | - // Read the strings |
|
117 | - for ($n = 1; $n < $number_of_strings; ++$n) { |
|
118 | - fseek($fp, $lookup_original[$n * 2 + 2]); |
|
119 | - $original = fread($fp, $lookup_original[$n * 2 + 1]); |
|
120 | - fseek($fp, $lookup_translated[$n * 2 + 2]); |
|
121 | - $translated = fread($fp, $lookup_translated[$n * 2 + 1]); |
|
122 | - $this->translations[$original] = $translated; |
|
123 | - } |
|
124 | - } |
|
116 | + // Read the strings |
|
117 | + for ($n = 1; $n < $number_of_strings; ++$n) { |
|
118 | + fseek($fp, $lookup_original[$n * 2 + 2]); |
|
119 | + $original = fread($fp, $lookup_original[$n * 2 + 1]); |
|
120 | + fseek($fp, $lookup_translated[$n * 2 + 2]); |
|
121 | + $translated = fread($fp, $lookup_translated[$n * 2 + 1]); |
|
122 | + $this->translations[$original] = $translated; |
|
123 | + } |
|
124 | + } |
|
125 | 125 | } |
@@ -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 | /** |
@@ -11,8 +11,8 @@ |
||
11 | 11 | */ |
12 | 12 | class LocaleEsDo extends LocaleEs |
13 | 13 | { |
14 | - public function territory() |
|
15 | - { |
|
16 | - return new TerritoryDo(); |
|
17 | - } |
|
14 | + public function territory() |
|
15 | + { |
|
16 | + return new TerritoryDo(); |
|
17 | + } |
|
18 | 18 | } |
@@ -11,18 +11,18 @@ |
||
11 | 11 | */ |
12 | 12 | class LocaleNds extends LocaleDe |
13 | 13 | { |
14 | - public function endonym() |
|
15 | - { |
|
16 | - return 'Neddersass’sch'; |
|
17 | - } |
|
14 | + public function endonym() |
|
15 | + { |
|
16 | + return 'Neddersass’sch'; |
|
17 | + } |
|
18 | 18 | |
19 | - public function endonymSortable() |
|
20 | - { |
|
21 | - return 'NEDDERSASS’SCH'; |
|
22 | - } |
|
19 | + public function endonymSortable() |
|
20 | + { |
|
21 | + return 'NEDDERSASS’SCH'; |
|
22 | + } |
|
23 | 23 | |
24 | - public function language() |
|
25 | - { |
|
26 | - return new LanguageNds(); |
|
27 | - } |
|
24 | + public function language() |
|
25 | + { |
|
26 | + return new LanguageNds(); |
|
27 | + } |
|
28 | 28 | } |
@@ -11,18 +11,18 @@ |
||
11 | 11 | */ |
12 | 12 | class LocaleNd extends AbstractLocale implements LocaleInterface |
13 | 13 | { |
14 | - public function endonym() |
|
15 | - { |
|
16 | - return 'isiNdebele'; |
|
17 | - } |
|
14 | + public function endonym() |
|
15 | + { |
|
16 | + return 'isiNdebele'; |
|
17 | + } |
|
18 | 18 | |
19 | - public function endonymSortable() |
|
20 | - { |
|
21 | - return 'ISINDEBELE'; |
|
22 | - } |
|
19 | + public function endonymSortable() |
|
20 | + { |
|
21 | + return 'ISINDEBELE'; |
|
22 | + } |
|
23 | 23 | |
24 | - public function language() |
|
25 | - { |
|
26 | - return new LanguageNd(); |
|
27 | - } |
|
24 | + public function language() |
|
25 | + { |
|
26 | + return new LanguageNd(); |
|
27 | + } |
|
28 | 28 | } |