AbstractFeatureJudge::getFeature()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
ccs 0
cts 0
cp 0
nc 1
1
<?php
2
3
namespace Jlis\Judge\Judges;
4
5
use Jlis\Judge\Adapters\AdapterInterface;
6
7
/**
8
 * @author Julius Ehrlich <[email protected]>
9
 */
10
abstract class AbstractFeatureJudge extends Judge implements FeatureJudgeInterface
11
{
12
    /**
13
     * @var array
14
     */
15
    protected $features = [];
16
17
    /**
18
     * Constructor.
19
     *
20
     * @param AdapterInterface $adapter
21
     * @param array            $voters
22
     */
23 35
    public function __construct(AdapterInterface $adapter, array $voters = [])
24
    {
25 35
        parent::__construct($adapter, $voters);
26 35
        $this->reloadFeatures();
27 35
    }
28
29
    /**
30
     * Reloads the features from the adapter.
31
     */
32 35
    public function reloadFeatures()
33
    {
34 35
        $this->features = $this->getFeatures();
35 35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    abstract public function decide($feature, $user = null, $defaultIfNotFound = false);
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    abstract public function featureExists($feature);
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    abstract public function getFeature($feature);
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    abstract public function getFeatures();
56
}
57