Completed
Push — master ( 28180f...9feb73 )
by Joachim
14:25
created

AbstractEntity::extract()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Zend\Hydrator\ClassMethods;
6
use Zend\Hydrator\HydratorInterface;
7
8
abstract class AbstractEntity
9
{
10
    public function hydrate(array $data)
11
    {
12
        $hydrator = $this->getHydrator();
13
        $hydrator->hydrate($data, $this);
14
    }
15
16
    public function extract() : array
17
    {
18
        $hydrator = $this->getHydrator();
19
        return $hydrator->extract($this);
20
    }
21
22
    /**
23
     * @return HydratorInterface
24
     */
25
    protected function getHydrator() : HydratorInterface
26
    {
27
        return new ClassMethods();
28
    }
29
}
30