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 |
||
| 7 | 37 | public function getDefinition() |
|
| 8 | { |
||
| 9 | 37 | $node = self::createNode('_enum_config'); |
|
| 10 | |||
| 11 | $node |
||
| 12 | 37 | ->children() |
|
| 13 | 37 | ->append($this->nameSection()) |
|
| 14 | 37 | ->arrayNode('values') |
|
| 15 | 37 | ->useAttributeAsKey('name') |
|
| 16 | 37 | ->beforeNormalization() |
|
| 17 | ->ifTrue(function ($v) { |
||
| 18 | 4 | return \is_array($v); |
|
| 19 | 37 | }) |
|
| 20 | ->then(function ($v) { |
||
| 21 | 4 | foreach ($v as $name => &$options) { |
|
| 22 | // short syntax NAME: VALUE |
||
| 23 | 4 | if (!\is_null($options) && !\is_array($options)) { |
|
| 24 | 2 | $options = ['value' => $options]; |
|
| 25 | } |
||
| 26 | |||
| 27 | // use name as value if no value given |
||
| 28 | 4 | if (!\array_key_exists('value', $options)) { |
|
|
|
|||
| 29 | 4 | $options['value'] = $name; |
|
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | 4 | return $v; |
|
| 34 | 37 | }) |
|
| 35 | 37 | ->end() |
|
| 36 | 37 | ->prototype('array') |
|
| 37 | 37 | ->isRequired() |
|
| 38 | 37 | ->children() |
|
| 39 | 37 | ->scalarNode('value')->isRequired()->end() |
|
| 40 | 37 | ->append($this->descriptionSection()) |
|
| 41 | 37 | ->append($this->deprecationReasonSelection()) |
|
| 42 | 37 | ->end() |
|
| 43 | 37 | ->end() |
|
| 44 | 37 | ->isRequired() |
|
| 45 | 37 | ->requiresAtLeastOneElement() |
|
| 46 | 37 | ->end() |
|
| 47 | 37 | ->append($this->descriptionSection()) |
|
| 48 | 37 | ->end(); |
|
| 49 | |||
| 50 | 37 | return $node; |
|
| 51 | } |
||
| 53 |