GetAllTranslations::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 8
cts 8
cp 1
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Omatech\Mage\Core\Adapters\Translations;
4
5
use Omatech\Mage\Core\Domains\Translations\Contracts\AllTranslationInterface;
6
use Omatech\Mage\Core\Repositories\TranslationBaseRepository;
7
8
class GetAllTranslations extends TranslationBaseRepository implements AllTranslationInterface
9
{
10
    /**
11
     * @param $locales
12
     * @return array
13
     */
14 2
    public function get(array $locales): array
15
    {
16 2
        $select = ['id', 'group', 'key'];
17
18 2
        foreach ($locales as $locale) {
19 2
            $select[] = "text->$locale as $locale";
20
        }
21
22 2
        return $this->query()
0 ignored issues
show
Bug introduced by
The method select() does not exist on Illuminate\Database\Eloquent\Builder. Did you maybe mean createSelectWithConstraint()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
23 2
            ->select($select)
24 2
            ->get()
25 2
            ->toArray();
26
    }
27
}
28