HydrationStrategy::extract()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Pgs\ElasticOM\Hydrator;
4
5
use Zend\Hydrator\Strategy\StrategyInterface;
6
7
class HydrationStrategy implements StrategyInterface
8
{
9
    /** @var Hydrator */
10
    protected $hydrator;
11
12 3
    public function __construct(Hydrator $hydrator)
13
    {
14 3
        $this->hydrator = $hydrator;
15 3
    }
16
17 2
    public function extract($value)
18
    {
19 2
        return is_object($value)
20 1
            ? $this->hydrator->extract($value, false)
21 2
            : $value;
22
    }
23
24 1
    public function hydrate($value)
25
    {
26 1
        return $value;
27
    }
28
}
29