Passed
Pull Request — master (#20)
by Igor
02:33
created

AbstractFieldAggregator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 13
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getValue() 0 3 1
1
<?php
2
/**
3
 * @author Igor Pomiluyko <[email protected]>
4
 */
5
6
namespace WS\Utils\Collections\Functions\Group\Aggregator;
7
8
use WS\Utils\Collections\Functions\ObjectFunctions;
9
10
abstract class AbstractFieldAggregator
11
{
12
13
    private $fieldName;
14
15 39
    public function __construct(string $fieldName)
16
    {
17 39
        $this->fieldName = $fieldName;
18 39
    }
19
20 33
    protected function getValue($element)
21
    {
22 33
        return ObjectFunctions::getPropertyValue($element, $this->fieldName);
23
    }
24
25
}
26