| Total Complexity | 8 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 91.67% |
| Changes | 5 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | class MessagingInfo extends Model |
||
| 14 | { |
||
| 15 | protected $guarded = []; |
||
| 16 | protected $appends = [ |
||
| 17 | 'startTime', |
||
| 18 | 'endTime' |
||
| 19 | ]; |
||
| 20 | |||
| 21 | 1 | public function getStartTimeAttribute() |
|
| 22 | { |
||
| 23 | 1 | if (isset($this->attributes['startTime'])) |
|
| 24 | return new Carbon($this->attributes['startTime']); |
||
| 25 | } |
||
| 26 | 1 | ||
| 27 | public function getEndTimeAttribute() |
||
| 28 | 1 | { |
|
| 29 | 1 | if (isset($this->attributes['endTime'])) { |
|
| 30 | if ($this->attributes['status'] == 'CLOSE') { |
||
| 31 | return new Carbon($this->attributes['endTime']); |
||
| 32 | } else { |
||
| 33 | return null; |
||
| 34 | } |
||
| 35 | 1 | } |
|
| 36 | } |
||
| 37 | 1 | ||
| 38 | public function getMinutesAttribute() |
||
| 39 | { |
||
| 40 | 1 | return round(($this->attributes['duration'] / 1000) / 60, 2); |
|
| 41 | } |
||
| 42 | 1 | ||
| 43 | public function getSecondsAttribute() |
||
| 44 | { |
||
| 45 | 1 | return $this->attributes['duration'] / 1000; |
|
| 46 | } |
||
| 47 | 1 | ||
| 48 | public function getHoursAttribute() |
||
| 51 | } |
||
| 52 | } |
||
| 53 |