LocaleValuesTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 0
f 0
dl 0
loc 25
ccs 0
cts 8
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLocales() 0 3 1
A getLocale() 0 3 1
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