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

StarPlayer::hydrateWithOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
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 StarPlayer extends AbstractInducement implements InducementInterface
9
{
10
    /** @var array $characteristics */
11
    protected $characteristics;
12
    /** @var array $skills */
13
    protected $skills;
14
15
    protected function hydrateWithOptions()
16
    {
17
        parent::hydrateWithOptions();
18
        $this->characteristics = $this->options['characteristics'] ?? [];
19
        $this->skills = $this->options['skills'] ?? [];
20
    }
21
22
    /**
23
     * @return array
24
     */
25
    public function getCharacteristics(): ?array
26
    {
27
        return $this->characteristics;
28
    }
29
30
    /**
31
     * @param array|null $characteristics
32
     * @return $this
33
     */
34
    public function setCharacteristics(?array $characteristics): self
35
    {
36
        $this->characteristics = $characteristics;
37
        return $this;
38
    }
39
40
    /**
41
     * @return array
42
     */
43
    public function getSkills(): ?array
44
    {
45
        return $this->skills;
46
    }
47
48
    /**
49
     * @param array|null $skills
50
     * @return $this
51
     */
52
    public function setSkills(?array $skills): self
53
    {
54
        $this->skills = $skills;
55
        return $this;
56
    }
57
58
    public function configureOptions(OptionsResolver $resolver):void
59
    {
60
        parent::configureOptions($resolver);
61
        $resolver->setDefaults([
62
            'characteristics' => null,
63
            'skills'          => null,
64
        ])
65
            ->setRequired(['characteristics'])
66
            ->setAllowedTypes('characteristics', ['array', 'null'])
67
            ->setAllowedTypes('skills', ['array', 'null'])
68
        ;
69
    }
70
}
71