Completed
Branch v1.x-dev (5736e4)
by Benjamin
04:09
created

Optionable::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Obblm\Core\Helper;
4
5
use Obblm\Core\Contracts\OptionableInterface;
6
use Symfony\Component\OptionsResolver\OptionsResolver;
7
8
abstract class Optionable implements OptionableInterface
9
{
10
    /** @var array */
11
    protected $options;
12
13 1
    public function __construct(array $options = [])
14
    {
15 1
        $this->resolveOptions($options);
16 1
        $this->hydrateWithOptions();
17 1
    }
18
19
    abstract protected function hydrateWithOptions();
20
21 1
    public function resolveOptions($options):void
22
    {
23 1
        $resolver = new OptionsResolver();
24 1
        $this->configureOptions($resolver);
25 1
        $this->options = $resolver->resolve($options);
26 1
    }
27
}
28