Passed
Push — master ( 0ff867...e378b0 )
by Бабичев
03:14
created

HasGetSettings::getSettingFloat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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 Illuminate\Database\Eloquent\Model 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 Illuminate\Database\Eloquent\Model 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 Illuminate\Database\Eloquent\Model 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 Illuminate\Database\Eloquent\Model 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 Illuminate\Database\Eloquent\Model 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 1
    public function getSetting(string $key): ?Setting
71
    {
72 1
        return app(ReadableService::class)
73 1
            ->getSetting($this, $key);
0 ignored issues
show
Bug introduced by
$this of type Bavix\Settings\Traits\HasGetSettings is incompatible with the type Illuminate\Database\Eloquent\Model 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