1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Helldar\LaravelLangPublisher\Config; |
6
|
|
|
|
7
|
|
|
use Helldar\LaravelLangPublisher\Constants\Config as ConfigConst; |
8
|
|
|
use Helldar\Support\Facades\Helpers\Ables\Arrayable; |
9
|
|
|
use Helldar\Support\Facades\Helpers\Instance; |
10
|
|
|
|
11
|
|
|
class Config |
12
|
|
|
{ |
13
|
|
|
public function vendor(): string |
14
|
|
|
{ |
15
|
|
|
return $this->getPrivate('path.base'); |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
public function resources(): string |
19
|
|
|
{ |
20
|
|
|
return $this->getPrivate('path.resources'); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function plugins(): array |
24
|
|
|
{ |
25
|
|
|
$private = $this->getPrivate('plugins'); |
26
|
|
|
$public = $this->getPublic('plugins'); |
27
|
|
|
|
28
|
|
|
return Arrayable::of($public) |
29
|
|
|
->merge($private) |
30
|
|
|
->unique() |
31
|
|
|
->filter(static function (string $plugin) { |
32
|
|
|
return Instance::exists($plugin); |
33
|
|
|
}) |
34
|
|
|
->get(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function hasInline(): bool |
38
|
|
|
{ |
39
|
|
|
return $this->getPublic('inline'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function hasAlignment(): bool |
43
|
|
|
{ |
44
|
|
|
return $this->getPublic('alignment'); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function excludes(): array |
48
|
|
|
{ |
49
|
|
|
return $this->getPublic('excludes'); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function case(): int |
53
|
|
|
{ |
54
|
|
|
return $this->getPublic('case'); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
protected function getPrivate(string $key) |
58
|
|
|
{ |
59
|
|
|
$key = $this->privateKey($key); |
60
|
|
|
|
61
|
|
|
return config($key); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
protected function getPublic(string $key) |
65
|
|
|
{ |
66
|
|
|
$key = $this->publicKey($key); |
67
|
|
|
|
68
|
|
|
return config($key); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
protected function privateKey(string $suffix): string |
72
|
|
|
{ |
73
|
|
|
return ConfigConst::PRIVATE_KEY . '.' . $suffix; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
protected function publicKey(string $suffix): string |
77
|
|
|
{ |
78
|
|
|
return ConfigConst::PUBLIC_KEY . '.' . $suffix; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|