HasGetSettings   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 66
ccs 18
cts 18
cp 1
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getSetting() 0 4 1
A getSettingInt() 0 4 1
A getSettingBool() 0 4 1
A getSettingFloat() 0 4 1
A getSettingArray() 0 4 1
A getSettingString() 0 4 1
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
$this of type Bavix\Settings\Traits\HasGetSettings is incompatible with the type Bavix\Settings\Interfaces\Settingable expected by parameter $model of Bavix\Settings\Services\...ervice::getSettingInt(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
            ->getSettingInt(/** @scrutinizer ignore-type */ $this, $key, $default);
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
Bug introduced by
$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 ignore-type  annotation

30
            ->getSettingFloat(/** @scrutinizer ignore-type */ $this, $key, $default);
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
Bug introduced by
$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 ignore-type  annotation

41
            ->getSettingBool(/** @scrutinizer ignore-type */ $this, $key, $default);
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
Bug introduced by
$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 ignore-type  annotation

52
            ->getSettingString(/** @scrutinizer ignore-type */ $this, $key, $default);
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
Bug introduced by
$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 ignore-type  annotation

63
            ->getSettingArray(/** @scrutinizer ignore-type */ $this, $key, $default);
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
Bug introduced by
$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 ignore-type  annotation

73
            ->getSetting(/** @scrutinizer ignore-type */ $this, $key);
Loading history...
74
    }
75
76
}
77