Completed
Branch develop (69883f)
by Benjamin
04:05
created

MultipleStarPlayer::hydrateWithOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Obblm\Core\Helper\Rule\Inducement;
4
5
use Obblm\Core\Contracts\InducementInterface;
6
use Symfony\Component\OptionsResolver\OptionsResolver;
7
8
class MultipleStarPlayer extends StarPlayer implements InducementInterface
9
{
10
    protected $parts = [];
11
12
    protected function hydrateWithOptions()
13
    {
14
        parent::hydrateWithOptions();
15
        $this->parts = $this->options['parts'] ?? [];
16
    }
17
18
    public function isMultiple(): bool
19
    {
20
        return true;
21
    }
22
23
    public function setParts(array $parts):self
24
    {
25
        $this->parts = $parts;
26
        return $this;
27
    }
28
29
    public function getParts():array
30
    {
31
        return $this->parts;
32
    }
33
34
    public function configureOptions(OptionsResolver $resolver):void
35
    {
36
        parent::configureOptions($resolver);
37
        $resolver->setDefaults([
38
            'parts' => null,
39
        ])
40
            ->setRequired(['parts'])
41
            ->setAllowedTypes('parts', ['array'])
42
        ;
43
    }
44
}
45