LocaleValuesTrait::getLocale()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zvermafia\Larastate\Traits;
6
7
use function trans;
8
9
trait LocaleValuesTrait
10
{
11
    use LocaleKeysTrait;
12
13
    /**
14
     * Get a localization for the given state and its value.
15
     *
16
     * @param string $state_name
17
     * @param mixed $state_value
18
     * @return string
19
     */
20
    private function getLocale(string $state_name, $state_value): string
21
    {
22
        return trans($this->getLocaleKey($state_name, $state_value));
0 ignored issues
show
Bug introduced by
The function trans was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

22
        return /** @scrutinizer ignore-call */ trans($this->getLocaleKey($state_name, $state_value));
Loading history...
23
    }
24
25
    /**
26
     * Get a localizations for the given state.
27
     *
28
     * @param string $state_name
29
     * @return array
30
     */
31
    private function getLocales(string $state_name): array
32
    {
33
        return trans($this->getLocalesKey($state_name));
0 ignored issues
show
Bug introduced by
The function trans was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

33
        return /** @scrutinizer ignore-call */ trans($this->getLocalesKey($state_name));
Loading history...
34
    }
35
}
36