Completed
Push — v3 ( 320a43...25ab4d )
by Fèvre
04:54
created

AppTranslateTrait::setTranslations()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 4
nc 3
nop 1
1
<?php
2
namespace App\Model\Behavior;
3
4
trait AppTranslateTrait
5
{
6
7
    /**
8
     * Set the transaltions to be saved.
9
     *
10
     * @param array $data The data to save.
11
     *
12
     * @return void
13
     */
14
    public function setTranslations($data = [])
15
    {
16
        if (array_key_exists('translations', $data)) {
17
            foreach ($data['translations'] as $locale => $dataLocale) {
18
                $this->translation($locale)->set($dataLocale, ['guard' => false]);
0 ignored issues
show
Bug introduced by
The method translation() does not exist on App\Model\Behavior\AppTranslateTrait. Did you maybe mean setTranslations()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
19
            }
20
        }
21
    }
22
}
23