1 | <?php |
||
2 | |||
3 | namespace Helldar\LaravelLangPublisher\Support\Path; |
||
4 | |||
5 | use Helldar\LaravelLangPublisher\Facades\Config; |
||
6 | |||
7 | final class Json extends BasePath |
||
8 | { |
||
9 | protected $is_json = true; |
||
10 | |||
11 | /** |
||
12 | * Returns a direct link to the folder with the source localization files. |
||
13 | * |
||
14 | * If the file name is specified, a full link to the file will be returned, |
||
15 | * otherwise a direct link to the folder. |
||
16 | * |
||
17 | * @param string|null $locale |
||
18 | * |
||
19 | * @return string |
||
20 | */ |
||
21 | public function source(string $locale = null): string |
||
22 | 54 | { |
|
23 | $directory = $this->getPathForEnglish($locale); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
24 | 54 | $locale = $this->clean($locale); |
|
25 | 54 | ||
26 | 54 | return $this->real( |
|
27 | Config::getVendorPath() . $directory . $locale . '.json' |
||
28 | 54 | ); |
|
29 | 54 | } |
|
30 | |||
31 | /** |
||
32 | * Returns the direct link to the localization folder or, |
||
33 | * if the file name is specified, a link to the localization file. |
||
34 | * |
||
35 | * If the file name or localization is not specified, |
||
36 | * the link to the shared folder of all localizations will be returned. |
||
37 | * |
||
38 | * @param string|null $locale |
||
39 | * @param string|null $filename |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | public function target(string $locale = null, string $filename = null): string |
||
44 | { |
||
45 | 54 | $locale = $this->clean($locale); |
|
46 | |||
47 | 54 | return resource_path(self::LANG . $locale . '.json'); |
|
48 | 54 | } |
|
49 | } |
||
50 |