AllTranslation::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\Repositories\Translations;
4
5
use Omatech\Mage\Core\Domains\Translations\Contracts\AllTranslationInterface;
6
use Omatech\Mage\Core\Repositories\TranslationBaseRepository;
7
8
class AllTranslation extends TranslationBaseRepository implements AllTranslationInterface
9
{
10
    /**
11
     * @param array $locales
12
     * @return mixed
13
     */
14 1
    public function get(array $locales)
15
    {
16 1
        $select = ['id', 'group', 'key'];
17
18 1
        foreach ($locales as $locale) {
19 1
            $select[] = "text->$locale as $locale";
20
        }
21
22 1
        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 1
            ->select($select)
24 1
            ->paginate()
25 1
            ->toArray();
26
    }
27
}
28