FilesStatuse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIdByKey() 0 7 2
A find() 0 2 1
1
<?php
2
/**
3
 * User: execut
4
 * Date: 18.07.16
5
 * Time: 9:54
6
 */
7
8
namespace execut\import\models;
9
class FilesStatuse extends base\FilesStatuse
10
{
11
    const NEW = 'new';
12
    const RELOAD = 'reload';
13
    const DELETE = 'delete';
14
    const LOADED = 'loaded';
15
    const LOADING = 'loading';
16
    const DELETING = 'deleting';
17
    const ERROR = 'error';
18
    const STOPED = 'stoped';
19
    const STOP = 'stop';
20
    protected static $statusesByKeys = [];
21
    public static function find() {
22
        return new \execut\import\models\queries\FilesStatuse(__CLASS__);
23
    }
24
25
    public static function getIdByKey($key)
26
    {
27
        if (empty(self::$statusesByKeys[$key])) {
28
            self::$statusesByKeys[$key] = self::find()->byKey($key)->select('id')->createCommand()->queryScalar();
29
        }
30
31
        return self::$statusesByKeys[$key];
32
    }
33
}