| Conditions | 3 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 3.0026 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 2 | public function getNode(TreeBuilder $builder = null) |
|
| 25 | { |
||
| 26 | 2 | $builder = $builder ?: new TreeBuilder(); |
|
| 27 | 2 | $node = $builder->root('repositories'); |
|
| 28 | |||
| 29 | $node |
||
| 30 | 2 | ->useAttributeAsKey('name') |
|
| 31 | 2 | ->prototype('scalar') |
|
| 32 | 2 | ->isRequired() |
|
| 33 | 2 | ->cannotBeEmpty() |
|
| 34 | 2 | ->validate() |
|
| 35 | 2 | ->ifTrue(function ($value) { |
|
| 36 | 2 | if ($value == 'search') { |
|
| 37 | return false; |
||
| 38 | } |
||
| 39 | |||
| 40 | 2 | return ! class_exists("PhraseanetSDK\\Repository\\" . ucfirst($value)); |
|
| 41 | 2 | }) |
|
| 42 | 2 | ->thenInvalid('Repository type does not exist.'); |
|
| 43 | |||
| 44 | 2 | return $node; |
|
| 45 | } |
||
| 46 | } |
||
| 47 |