Completed
Push — develop ( e85978...1dc639 )
by Jens
05:42
created

HandlebarsHelperService::getHelperMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
7
namespace JaySDe\HandlebarsBundle;
8
9
use JaySDe\HandlebarsBundle\Helper\HelperInterface;
10
11
class HandlebarsHelperService implements HandlebarsHelperServiceInterface
12
{
13
    private $helpers = [];
14
15
    /**
16
     * @inheritdoc
17
     */
18 5
    public function addHelper($id, $helper)
19
    {
20 5
        if ($helper instanceof HelperInterface) {
21 2
            $this->helpers[$id] = [$helper, 'handle'];
22 3
        } elseif (is_callable($helper)) {
23 2
            $this->helpers[$id] = $helper;
24
        }
25 5
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 1
    public function getHelperMethods()
31
    {
32 1
        return array_keys($this->helpers);
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38 3
    public function getHelpers()
39
    {
40 3
        return $this->helpers;
41
    }
42
}
43