1 | <?php |
||
15 | class FileLoader extends IlluminateFileLoader |
||
16 | { |
||
17 | /* ----------------------------------------------------------------- |
||
18 | | Properties |
||
19 | | ----------------------------------------------------------------- |
||
20 | */ |
||
21 | |||
22 | /** |
||
23 | * Vendor directory path. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $vendorPaths; |
||
28 | |||
29 | /** |
||
30 | * Supported locales. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $locales; |
||
35 | |||
36 | /* ----------------------------------------------------------------- |
||
37 | | Constructor |
||
38 | | ----------------------------------------------------------------- |
||
39 | */ |
||
40 | |||
41 | /** |
||
42 | * Create a new file loader instance. |
||
43 | * |
||
44 | * @param \Illuminate\Filesystem\Filesystem $files |
||
45 | * @param string $path |
||
46 | * @param array $vendorPaths |
||
47 | * @param array $locales |
||
48 | */ |
||
49 | 66 | public function __construct(Filesystem $files, string $path, array $vendorPaths, array $locales = []) |
|
56 | |||
57 | /* ----------------------------------------------------------------- |
||
58 | | Getters & Setters |
||
59 | | ----------------------------------------------------------------- |
||
60 | */ |
||
61 | |||
62 | /** |
||
63 | * Get the vendor path. |
||
64 | * |
||
65 | * @return array |
||
66 | */ |
||
67 | 6 | private function getVendorPaths(): array |
|
71 | |||
72 | /** |
||
73 | * Set the vendor paths. |
||
74 | * |
||
75 | * @param array $vendorPaths |
||
76 | * |
||
77 | * @return $this |
||
78 | */ |
||
79 | 66 | private function setVendorPaths(array $vendorPaths): self |
|
85 | |||
86 | /** |
||
87 | * Set the supported locales. |
||
88 | * |
||
89 | * @param array $locales |
||
90 | * |
||
91 | * @return $this |
||
92 | */ |
||
93 | 66 | private function setSupportedLocales(array $locales): self |
|
99 | |||
100 | /* ----------------------------------------------------------------- |
||
101 | | Main Methods |
||
102 | | ----------------------------------------------------------------- |
||
103 | */ |
||
104 | |||
105 | /** |
||
106 | * Load the messages for the given locale. |
||
107 | * |
||
108 | * @param string $locale |
||
109 | * @param string $group |
||
110 | * @param string $namespace |
||
111 | * |
||
112 | * @return array |
||
113 | */ |
||
114 | 12 | public function load($locale, $group, $namespace = null): array |
|
127 | |||
128 | /* ----------------------------------------------------------------- |
||
129 | | Check Methods |
||
130 | | ----------------------------------------------------------------- |
||
131 | */ |
||
132 | |||
133 | /** |
||
134 | * Check if the locale is supported or use the fallback. |
||
135 | * |
||
136 | * @param string $locale |
||
137 | * |
||
138 | * @return bool |
||
139 | */ |
||
140 | 12 | private function isSupported($locale): bool |
|
144 | } |
||
145 |