Description::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
/*
3
 * This file is part of the Adlogix package.
4
 *
5
 * (c) Allan Segebarth <[email protected]>
6
 * (c) Jean-Jacques Courtens <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Adlogix\Zf2Rollout\View\Helper;
13
14
15
use Zend\View\Helper\AbstractHelper;
16
17
/**
18
 * Returns the description of a given feature.
19
 *
20
 * @package Adlogix\Zf2Rollout\View\Helper
21
 * @author Laurent De Coninck <[email protected]>
22
 */
23
class Description extends AbstractHelper
24
{
25
    /**
26
     * @var array
27
     */
28
    private $features;
29
30
    public function __construct(array $features = [])
31
    {
32
        $this->features = $features;
33
    }
34
35
    /**
36
     * Returns the description of a feature.
37
     *
38
     * @param string $feature
39
     *
40
     * @return string|null
41
     */
42
    public function __invoke($feature)
43
    {
44
        if (!isset($this->features[$feature]['description'])) {
45
            return '';
46
        }
47
48
        return $this->features[$feature]['description'];
49
    }
50
51
}