Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
15 | 9 | public function find(array $params) |
|
16 | { |
||
17 | 9 | $translation = $this->query() |
|
18 | 9 | ->where(DB::raw("CONCAT(`group`, '.', `key`)"), $params['key']) |
|
19 | 9 | ->first(); |
|
20 | |||
21 | 9 | if (null === $translation) { |
|
22 | 8 | return app('mage.translations')::fromArray([ |
|
23 | 8 | 'key' => $params['key'], |
|
24 | ]); |
||
25 | } |
||
26 | |||
27 | 3 | $translation = app('mage.translations')::fromArray([ |
|
28 | 3 | 'id' => $translation->id, |
|
29 | 3 | 'key' => $translation->group.'.'.$translation->key, |
|
30 | 3 | 'translations' => $translation->text, |
|
31 | 3 | 'sync_at' => $translation->sync_at, |
|
32 | 3 | 'created_at' => $translation->created_at, |
|
33 | 3 | 'updated_at' => $translation->updated_at, |
|
34 | ]); |
||
35 | |||
36 | 3 | return $translation; |
|
37 | } |
||
38 | } |
||
39 |