| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Bavix\Settings\Traits; |
||||
| 4 | |||||
| 5 | use Bavix\Settings\Models\Setting; |
||||
| 6 | use Bavix\Settings\Services\ReadableService; |
||||
| 7 | |||||
| 8 | trait HasGetSettings |
||||
| 9 | { |
||||
| 10 | |||||
| 11 | /** |
||||
| 12 | * @param string $key |
||||
| 13 | * @param int|null $default |
||||
| 14 | * @return int|null |
||||
| 15 | */ |
||||
| 16 | 1 | public function getSettingInt(string $key, ?int $default = null): ?int |
|||
| 17 | { |
||||
| 18 | 1 | return app(ReadableService::class) |
|||
| 19 | 1 | ->getSettingInt($this, $key, $default); |
|||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 20 | } |
||||
| 21 | |||||
| 22 | /** |
||||
| 23 | * @param string $key |
||||
| 24 | * @param float|null $default |
||||
| 25 | * @return float|null |
||||
| 26 | */ |
||||
| 27 | 1 | public function getSettingFloat(string $key, ?float $default = null): ?float |
|||
| 28 | { |
||||
| 29 | 1 | return app(ReadableService::class) |
|||
| 30 | 1 | ->getSettingFloat($this, $key, $default); |
|||
|
0 ignored issues
–
show
$this of type Bavix\Settings\Traits\HasGetSettings is incompatible with the type Bavix\Settings\Interfaces\Settingable expected by parameter $model of Bavix\Settings\Services\...vice::getSettingFloat().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 31 | } |
||||
| 32 | |||||
| 33 | /** |
||||
| 34 | * @param string $key |
||||
| 35 | * @param bool|null $default |
||||
| 36 | * @return bool|null |
||||
| 37 | */ |
||||
| 38 | 1 | public function getSettingBool(string $key, ?bool $default = null): ?bool |
|||
| 39 | { |
||||
| 40 | 1 | return app(ReadableService::class) |
|||
| 41 | 1 | ->getSettingBool($this, $key, $default); |
|||
|
0 ignored issues
–
show
$this of type Bavix\Settings\Traits\HasGetSettings is incompatible with the type Bavix\Settings\Interfaces\Settingable expected by parameter $model of Bavix\Settings\Services\...rvice::getSettingBool().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 42 | } |
||||
| 43 | |||||
| 44 | /** |
||||
| 45 | * @param string $key |
||||
| 46 | * @param string|null $default |
||||
| 47 | * @return string|null |
||||
| 48 | */ |
||||
| 49 | 1 | public function getSettingString(string $key, ?string $default = null): ?string |
|||
| 50 | { |
||||
| 51 | 1 | return app(ReadableService::class) |
|||
| 52 | 1 | ->getSettingString($this, $key, $default); |
|||
|
0 ignored issues
–
show
$this of type Bavix\Settings\Traits\HasGetSettings is incompatible with the type Bavix\Settings\Interfaces\Settingable expected by parameter $model of Bavix\Settings\Services\...ice::getSettingString().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 53 | } |
||||
| 54 | |||||
| 55 | /** |
||||
| 56 | * @param string $key |
||||
| 57 | * @param array|null $default |
||||
| 58 | * @return array|null |
||||
| 59 | */ |
||||
| 60 | 1 | public function getSettingArray(string $key, ?array $default = null): ?array |
|||
| 61 | { |
||||
| 62 | 1 | return app(ReadableService::class) |
|||
| 63 | 1 | ->getSettingArray($this, $key, $default); |
|||
|
0 ignored issues
–
show
$this of type Bavix\Settings\Traits\HasGetSettings is incompatible with the type Bavix\Settings\Interfaces\Settingable expected by parameter $model of Bavix\Settings\Services\...vice::getSettingArray().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 64 | } |
||||
| 65 | |||||
| 66 | /** |
||||
| 67 | * @param string $key |
||||
| 68 | * @return Setting|null |
||||
| 69 | */ |
||||
| 70 | 3 | public function getSetting(string $key): ?Setting |
|||
| 71 | { |
||||
| 72 | 3 | return app(ReadableService::class) |
|||
| 73 | 3 | ->getSetting($this, $key); |
|||
|
0 ignored issues
–
show
$this of type Bavix\Settings\Traits\HasGetSettings is incompatible with the type Bavix\Settings\Interfaces\Settingable expected by parameter $model of Bavix\Settings\Services\...leService::getSetting().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 74 | } |
||||
| 75 | |||||
| 76 | } |
||||
| 77 |