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

TranslatedTrait   A

Complexity

Total Complexity 35

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 35
c 4
b 1
f 0
lcom 0
cbo 0
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 9

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transactions() 0 6 1
A hasTranslate() 0 4 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
}