Completed
Push — master ( 38078c...bdabf3 )
by Loban
04:23
created

TranslatedTrait::transactions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 6
rs 9.4286
ccs 3
cts 3
cp 1
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @link https://github.com/LAV45/yii2-translated-behavior
4
 * @copyright Copyright (c) 2015 LAV45!
5
 * @author Alexey Loban <[email protected]>
6
 * @license http://opensource.org/licenses/BSD-3-Clause
7
 */
8
9
namespace lav45\translate;
10
11
use yii\db\ActiveRecord;
12
13
/**
14
 * Class TranslatedTrait
15
 * @package lav45\translate
16
 *
17
 * @mixin TranslatedBehavior
18
 */
19
trait TranslatedTrait
20
{
21 4
    public function transactions()
22
    {
23
        return [
24 4
            ActiveRecord::SCENARIO_DEFAULT => ActiveRecord::OP_ALL,
25 4
        ];
26
    }
27
28
    /**
29
     * @param string $language
30
     * @return bool
31
     */
32 2
    public function hasTranslate($language)
33
    {
34 2
        return isset($this['hasTranslate'][$language]);
35
    }
36
}