Completed
Push — master ( 1df19b...3d6a4b )
by Trevor N.
11s
created

AbstractDelegateContextualHydrator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 19
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hydrate() 0 6 1
1
<?php
2
/**
3
 * Incoming
4
 *
5
 * @author    Trevor Suarez (Rican7)
6
 * @copyright (c) Trevor Suarez
7
 * @link      https://github.com/Rican7/incoming
8
 * @license   MIT
9
 */
10
11
declare(strict_types=1);
12
13
namespace Incoming\Hydrator;
14
15
use Incoming\Structure\Map;
16
17
/**
18
 * An abstract, context enabled extension of the `AbstractDelegateHydrator`.
19
 *
20
 * @see AbstractDelegateHydrator
21
 */
22
abstract class AbstractDelegateContextualHydrator extends AbstractDelegateHydrator implements ContextualHydrator
23
{
24
25
    /**
26
     * {@inheritdoc}
27
     *
28
     * @param mixed $incoming The input data.
29
     * @param mixed $model The model to hydrate.
30
     * @param Map|null $context An optional generic key-value map, for providing
31
     *  contextual values during the hydrate process.
32
     * @return mixed The hydrated model.
33
     */
34 3
    public function hydrate($incoming, $model, Map $context = null)
35
    {
36 3
        $callable = $this->getDelegate();
37
38 3
        return $callable($incoming, $model, $context);
39
    }
40
}
41