Schedulelog::setEndAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace PendoNL\LaravelScheduleLogger;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Schedulelog extends Model
8
{
9
    protected $fillable = ['command_name', 'start', 'end'];
10
11
    public $timestamps = true;
12
13
    /**
14
     * Set start attribute. Multiply by 1000 to get milliseconds as integer.
15
     *
16
     * @param $value
17
     *
18
     * @return string
19
     */
20
    public function setStartAttribute($value)
21
    {
22
        $this->attributes['start'] = number_format($value * 1000, 0, '', '');
23
    }
24
25
    /**
26
     * Set end attribute. Multiply by 1000 to get milliseconds as integer.
27
     *
28
     * @param $value
29
     *
30
     * @return string
31
     */
32
    public function setEndAttribute($value)
33
    {
34
        $this->attributes['end'] = number_format($value * 1000, 0, '', '');
35
    }
36
}
37