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

Optionable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A resolveOptions() 0 5 1
A __construct() 0 4 1
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