TaskConfiguration::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 20
ccs 10
cts 10
cp 1
crap 1
rs 9.6
c 0
b 0
f 0
1
<?php
2
3
namespace JK\Sam\Task;
4
5
use JK\Sam\Configuration\Configuration;
6
use Symfony\Component\OptionsResolver\OptionsResolver;
7
8
/**
9
 * Configured Tasks options.
10
 */
11
class TaskConfiguration extends Configuration
12
{
13
    /**
14
     * Define allowed parameters and values for this configuration, using optionsResolver component.
15
     *
16
     * @param OptionsResolver $resolver
17
     */
18 2
    public function configureOptions(OptionsResolver $resolver)
19
    {
20
        $resolver
21
            // filter option is required
22 2
            ->setRequired('filters')
23 2
            ->setAllowedTypes('filters', 'array')
24
25
            // sources is required and should be an array
26 2
            ->setRequired('sources')
27 2
            ->setAllowedTypes('sources', 'array')
28
29
            // destination should be a string, no array is allowed for now
30 2
            ->setRequired('destinations')
31 2
            ->setAllowedTypes('destinations', 'array')
32
33
            // debug mode (allow more verbosity)
34 2
            ->setDefault('debug', false)
35 2
            ->setAllowedTypes('debug', 'boolean')
36
        ;
37 2
    }
38
}
39