Model   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 0 4 1
A behaviors() 0 6 1
A shouldBeSearchable() 0 4 1
1
<?php
2
/**
3
 * @link https://github.com/vuongxuongminh/yii2-searchable
4
 * @copyright Copyright (c) 2019 Vuong Xuong Minh
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
namespace vxm\test\unit\searchable;
9
10
use vxm\searchable\SearchableBehavior;
11
use yii\db\ActiveRecord;
12
13
use vxm\searchable\SearchableTrait;
14
15
/**
16
 * Class Model
17
 *
18
 * @property int $id
19
 * @property string $title
20
 * @property string $article
21
 *
22
 * @author Vuong Minh <[email protected]>
23
 * @since 1.0.0
24
 */
25
class Model extends ActiveRecord
26
{
27
28
    use SearchableTrait;
29
30
    public $shouldBeSearchable = true;
31
32
    /**
33
     * @inheritDoc
34
     */
35
    public static function tableName()
36
    {
37
        return 'articles';
38
    }
39
40
    /**
41
     * @inheritDoc
42
     */
43
    public function behaviors()
44
    {
45
        return [
46
            'searchable' => SearchableBehavior::class
47
        ];
48
    }
49
50
    public function shouldBeSearchable(): bool
51
    {
52
        return $this->shouldBeSearchable;
53
    }
54
55
}
56