Completed
Push — 186-data ( 572d68...d14d7f )
by
unknown
10:34
created

DataHydrateTemplate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A hydrateTemplate() 0 3 1
1
<?php
2
3
namespace League\Plates\Extension\Data;
4
5
use League\Plates;
6
7
final class DataHydrateTemplate implements Plates\HydrateTemplate
8
{
9
    private $resolve_data;
10
11
    public function __construct(callable $resolve_data) {
12
        $this->resolve_data = $resolve_data;
13
    }
14
15
    public function hydrateTemplate(Plates\Template $template) {
16
        $template->data = ($this->resolve_data)(ResolveDataArgs::fromTemplate($template));
17
    }
18
}
19