We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 5 |
Paths | 1 |
Total Lines | 44 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Tests | 31 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
9 | 37 | public function getDefinition() |
|
10 | { |
||
11 | 37 | $node = self::createNode('_enum_config'); |
|
12 | |||
13 | $node |
||
14 | 37 | ->children() |
|
15 | 37 | ->append($this->nameSection()) |
|
16 | 37 | ->arrayNode('values') |
|
17 | 37 | ->useAttributeAsKey('name') |
|
18 | 37 | ->beforeNormalization() |
|
19 | ->ifTrue(function ($v) { |
||
20 | 4 | return \is_array($v); |
|
21 | 37 | }) |
|
22 | ->then(function ($v) { |
||
23 | 4 | foreach ($v as $name => &$options) { |
|
24 | // short syntax NAME: VALUE |
||
25 | 4 | if (!\is_null($options) && !\is_array($options)) { |
|
26 | 2 | $options = ['value' => $options]; |
|
27 | } |
||
28 | |||
29 | // use name as value if no value given |
||
30 | 4 | if (!\array_key_exists('value', $options)) { |
|
|
|||
31 | 4 | $options['value'] = $name; |
|
32 | } |
||
33 | } |
||
34 | |||
35 | 4 | return $v; |
|
36 | 37 | }) |
|
37 | 37 | ->end() |
|
38 | 37 | ->prototype('array') |
|
39 | 37 | ->isRequired() |
|
40 | 37 | ->children() |
|
41 | 37 | ->scalarNode('value')->isRequired()->end() |
|
42 | 37 | ->append($this->descriptionSection()) |
|
43 | 37 | ->append($this->deprecationReasonSelection()) |
|
44 | 37 | ->end() |
|
45 | 37 | ->end() |
|
46 | 37 | ->isRequired() |
|
47 | 37 | ->requiresAtLeastOneElement() |
|
48 | 37 | ->end() |
|
49 | 37 | ->append($this->descriptionSection()) |
|
50 | 37 | ->end(); |
|
51 | |||
52 | 37 | return $node; |
|
53 | } |
||
55 |