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

GetAllTranslations   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 18
ccs 0
cts 8
cp 0
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
    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