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

GetAllTranslations   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 12 2
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