1 | <?php namespace Arcanedev\Localization\Entities; |
||
11 | class LocaleCollection extends Collection |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Properties |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | /** |
||
19 | * Supported locales. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $supported = []; |
||
24 | |||
25 | /* ----------------------------------------------------------------- |
||
26 | | Getters & Setters |
||
27 | | ----------------------------------------------------------------- |
||
28 | */ |
||
29 | |||
30 | /** |
||
31 | * Set supported locales keys. |
||
32 | * |
||
33 | * @param array $supported |
||
34 | * |
||
35 | * @return self |
||
36 | */ |
||
37 | 8 | public function setSupportedKeys(array $supported) |
|
43 | |||
44 | /* ----------------------------------------------------------------- |
||
45 | | Main Methods |
||
46 | | ----------------------------------------------------------------- |
||
47 | */ |
||
48 | |||
49 | /** |
||
50 | * Get the first locale from the collection. |
||
51 | * |
||
52 | * @param callable|null $callback |
||
53 | * @param mixed $default |
||
54 | * |
||
55 | * @return \Arcanedev\Localization\Entities\Locale|mixed |
||
56 | */ |
||
57 | 4 | public function first(callable $callback = null, $default = null) |
|
61 | |||
62 | /** |
||
63 | * Get supported locales collection. |
||
64 | * |
||
65 | * @return \Arcanedev\Localization\Entities\SupportedLocaleCollection |
||
66 | */ |
||
67 | 6 | public function getSupported() |
|
75 | |||
76 | /** |
||
77 | * Transform the collection with only locale's native name. |
||
78 | * |
||
79 | * @return \Illuminate\Support\Collection |
||
80 | */ |
||
81 | public function toNative() |
||
87 | |||
88 | /** |
||
89 | * Load from config. |
||
90 | * |
||
91 | * @return self |
||
92 | */ |
||
93 | 4 | public function loadFromConfig() |
|
104 | |||
105 | /** |
||
106 | * Load locales from array. |
||
107 | * |
||
108 | * @param array $locales |
||
109 | * |
||
110 | * @return self |
||
111 | */ |
||
112 | 254 | public function loadFromArray(array $locales) |
|
122 | } |
||
123 |