Completed
Push — master ( 808eaf...89b4c3 )
by Christian
07:18
created

GetAllTranslations::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

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 8
cts 8
cp 1
crap 2
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 2
    public function get($locales): array
14
    {
15 2
        $select = ['id', 'group', 'key'];
16
17 2
        foreach ($locales as $locale) {
18 2
            $select[] = "text->$locale as $locale";
19
        }
20
21 2
        return $this->query()
22 2
            ->select($select)
23 2
            ->get()
24 2
            ->toArray();
25
    }
26
}
27