Conditions | 2 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
45 | 16 | protected function configureOptions(OptionsResolver $resolver) |
|
46 | { |
||
47 | // Set default options. |
||
48 | 16 | $resolver->setDefaults(array( |
|
49 | 16 | 'indent-spaces' => 4, |
|
50 | 16 | 'output' => 'compact', |
|
51 | 'throw-on-error' => false |
||
52 | 16 | )); |
|
53 | |||
54 | // Validation |
||
55 | 16 | $resolver->setAllowedValues('indent-spaces', function ($value) { |
|
56 | 16 | if (!is_int($value)) { |
|
57 | 1 | return false; |
|
58 | } |
||
59 | |||
60 | 15 | return $value >= 0; |
|
61 | 16 | }); |
|
62 | 16 | $resolver->setAllowedValues('output', array('compact', 'pretty')); |
|
63 | 16 | $resolver->setAllowedTypes('throw-on-error', 'bool'); |
|
64 | 16 | } |
|
65 | } |
||
66 |