| Conditions | 3 |
| Paths | 1 |
| Total Lines | 61 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 30 | public function getConfigTreeBuilder() |
||
| 31 | { |
||
| 32 | $treeBuilder = new TreeBuilder(); |
||
| 33 | $rootNode = $treeBuilder->root('veslo_app'); |
||
| 34 | |||
| 35 | $rootNode |
||
| 36 | ->children() |
||
| 37 | ->arrayNode('http') |
||
| 38 | ->children() |
||
| 39 | ->append($this->getHttpClientNode()) |
||
| 40 | ->append($this->getHttpProxyNode()) |
||
| 41 | ->end() |
||
| 42 | ->validate() |
||
| 43 | ->ifTrue(function ($v) { |
||
| 44 | if (empty($v['client']['proxy']['enabled'])) { |
||
| 45 | return false; |
||
| 46 | } |
||
| 47 | |||
| 48 | return !is_array($v['proxy']['static_list']) || !count($v['proxy']['static_list']); |
||
| 49 | }) |
||
| 50 | ->thenInvalid('\'http.proxy.static_list\' must have at least one entry if proxy is enabled for the client') |
||
| 51 | ->end() |
||
| 52 | ->end() |
||
| 53 | ->append($this->getAmqpClientNode()) |
||
| 54 | ->arrayNode('workflow') |
||
| 55 | ->children() |
||
| 56 | ->arrayNode('vacancy_research') |
||
| 57 | ->children() |
||
| 58 | ->arrayNode('transitions') |
||
| 59 | ->children() |
||
| 60 | ->scalarNode('queue_prefix') |
||
| 61 | ->isRequired() |
||
| 62 | ->cannotBeEmpty() |
||
| 63 | ->end() |
||
| 64 | ->end() |
||
| 65 | ->end() |
||
| 66 | ->end() |
||
| 67 | ->end() |
||
| 68 | ->end() |
||
| 69 | ->end() |
||
| 70 | ->arrayNode('monolog') |
||
| 71 | ->children() |
||
| 72 | ->arrayNode('formatter') |
||
| 73 | ->children() |
||
| 74 | ->arrayNode('line') |
||
| 75 | ->children() |
||
| 76 | ->scalarNode('format') |
||
| 77 | ->isRequired() |
||
| 78 | ->cannotBeEmpty() |
||
| 79 | ->end() |
||
| 80 | ->end() |
||
| 81 | ->end() |
||
| 82 | ->end() |
||
| 83 | ->end() |
||
| 84 | ->end() |
||
| 85 | ->end() |
||
| 86 | ->end() |
||
| 87 | ; |
||
| 88 | |||
| 89 | return $treeBuilder; |
||
| 90 | } |
||
| 91 | |||
| 218 |