Completed
Push — master ( 79fd8a...81e819 )
by Christian
05:05
created

GetAllTranslations::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 12
ccs 0
cts 8
cp 0
crap 6
rs 10
1
<?php
2
3
namespace Omatech\Mage\Core\Adapters\Translations;
4
5
use Omatech\Mage\Core\Repositories\TranslationRepository;
6
7
class GetAllTranslations extends TranslationRepository
8
{
9
    /**
10
     * @param $locales
11
     * @return array
12
     */
13
    public function get($locales): array
14
    {
15
        $select = ['id', 'group', 'key'];
16
17
        foreach ($locales as $locale) {
18
            $select[] = "text->$locale as $locale";
19
        }
20
21
        return $this->query()
22
            ->select($select)
23
            ->get()
24
            ->toArray();
25
    }
26
}
27