SchedulerLog   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 14
ccs 0
cts 7
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A getDuration() 0 7 1
1
<?php
2
/**
3
 * @copyright Copyright(c) 2016 Webtools Ltd
4
 * @link https://github.com/thamtech/yii2-scheduler
5
 * @license https://opensource.org/licenses/MIT
6
**/
7
8
namespace thamtech\scheduler\models;
9
10
use Yii;
11
12
/**
13
 * This is the model class for table "scheduler_log".
14
 */
15
class SchedulerLog extends \thamtech\scheduler\models\base\SchedulerLog
16
{
17
    public function __toString()
18
    {
19
        return Yii::$app->formatter->asDatetime($this->started_at);
20
    }
21
22
    public function getDuration()
23
    {
24
        $start = new \DateTime($this->started_at);
25
        $end = new \DateTime($this->ended_at);
26
        $diff = $start->diff($end);
27
28
        return $diff->format('%hh %im %Ss');
29
    }
30
31
}
32