Test Failed
Branch development (1f4e65)
by Robert
11:57
created

Timeable::totalDurationSeconds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
	
3
namespace LivePersonInc\LiveEngageLaravel\Traits;
4
5
use LivePersonInc\LiveEngageLaravel\Facades\LiveEngageLaravel as LiveEngage;
6
7
trait Timeable
8
{
9
	
10
	public function averageDurationMinutes()
11
	{
12
		return $this->totalDurationMinutes() / $this->count();
0 ignored issues
show
Bug introduced by
It seems like count() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

12
		return $this->totalDurationMinutes() / $this->/** @scrutinizer ignore-call */ count();
Loading history...
13
	}
14
	
15
	public function averageDurationSeconds()
16
	{
17
		return $this->totalDurationSeconds() / $this->count();
18
	}
19
	
20
	public function totalDurationMinutes($filter = [])
21
	{
22
		return $this->sum(function($item) use ($filter) {
0 ignored issues
show
Unused Code introduced by
The import $filter is not used and could be removed.

This check looks for imports that have been defined, but are not used in the scope.

Loading history...
Bug introduced by
It seems like sum() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
		return $this->/** @scrutinizer ignore-call */ sum(function($item) use ($filter) {
Loading history...
23
			return $item->info->minutes;
24
		});
25
	}
26
	
27
	public function totalDurationSeconds($filter = [])
28
	{
29
		return $this->sum(function($item) use ($filter) {
0 ignored issues
show
Unused Code introduced by
The import $filter is not used and could be removed.

This check looks for imports that have been defined, but are not used in the scope.

Loading history...
30
			return $item->info->seconds;
31
		});
32
	}
33
	
34
}