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

MultipleStarPlayer   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 34
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isMultiple() 0 3 1
A getParts() 0 3 1
A setParts() 0 4 1
A configureOptions() 0 8 1
A hydrateWithOptions() 0 4 1
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