TaskConfiguration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 28
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A configureOptions() 0 20 1
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