| Conditions | 1 |
| Paths | 1 |
| Total Lines | 73 |
| Code Lines | 67 |
| 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 |
||
| 88 | protected function getCapabilitiesNode() |
||
| 89 | { |
||
| 90 | $node = new ArrayNodeDefinition('capabilities'); |
||
| 91 | |||
| 92 | $node |
||
| 93 | ->addDefaultsIfNotSet() |
||
| 94 | ->normalizeKeys(false) |
||
| 95 | ->children() |
||
| 96 | ->scalarNode('browserName')->end() |
||
| 97 | ->scalarNode('version')->end() |
||
| 98 | ->scalarNode('platform')->end() |
||
| 99 | ->scalarNode('browserVersion')->end() |
||
| 100 | ->scalarNode('browser')->defaultValue('firefox')->end() |
||
| 101 | ->booleanNode('marionette')->defaultNull()->end() |
||
| 102 | ->booleanNode('ignoreZoomSetting')->defaultFalse()->end() |
||
| 103 | ->scalarNode('name')->defaultValue('Behat feature suite')->end() |
||
| 104 | ->scalarNode('deviceOrientation')->end() |
||
| 105 | ->scalarNode('deviceType')->end() |
||
| 106 | ->booleanNode('javascriptEnabled')->end() |
||
| 107 | ->booleanNode('databaseEnabled')->end() |
||
| 108 | ->booleanNode('locationContextEnabled')->end() |
||
| 109 | ->booleanNode('applicationCacheEnabled')->end() |
||
| 110 | ->booleanNode('browserConnectionEnabled')->end() |
||
| 111 | ->booleanNode('webStorageEnabled')->end() |
||
| 112 | ->booleanNode('rotatable')->end() |
||
| 113 | ->booleanNode('acceptSslCerts')->end() |
||
| 114 | ->booleanNode('nativeEvents')->end() |
||
| 115 | ->booleanNode('overlappingCheckDisabled')->end() |
||
| 116 | ->arrayNode('proxy') |
||
| 117 | ->children() |
||
| 118 | ->scalarNode('proxyType')->end() |
||
| 119 | ->scalarNode('proxyAuthconfigUrl')->end() |
||
| 120 | ->scalarNode('ftpProxy')->end() |
||
| 121 | ->scalarNode('httpProxy')->end() |
||
| 122 | ->scalarNode('sslProxy')->end() |
||
| 123 | ->end() |
||
| 124 | ->validate() |
||
| 125 | ->ifTrue(function ($v) { |
||
| 126 | return empty($v); |
||
| 127 | }) |
||
| 128 | ->thenUnset() |
||
| 129 | ->end() |
||
| 130 | ->end() |
||
| 131 | ->arrayNode('firefox') |
||
| 132 | ->children() |
||
| 133 | ->scalarNode('profile') |
||
| 134 | ->validate() |
||
| 135 | ->ifTrue(function ($v) { |
||
| 136 | return !file_exists($v); |
||
| 137 | }) |
||
| 138 | ->thenInvalid('Cannot find profile zip file %s') |
||
| 139 | ->end() |
||
| 140 | ->end() |
||
| 141 | ->scalarNode('binary')->end() |
||
| 142 | ->end() |
||
| 143 | ->end() |
||
| 144 | ->arrayNode('chrome') |
||
| 145 | ->children() |
||
| 146 | ->arrayNode('switches')->prototype('scalar')->end()->end() |
||
| 147 | ->scalarNode('binary')->end() |
||
| 148 | ->arrayNode('extensions')->prototype('scalar')->end()->end() |
||
| 149 | ->end() |
||
| 150 | ->end() |
||
| 151 | ->arrayNode('extra_capabilities') |
||
| 152 | ->info('Custom capabilities merged with the known ones') |
||
| 153 | ->normalizeKeys(false) |
||
| 154 | ->useAttributeAsKey('name') |
||
| 155 | ->prototype('variable')->end() |
||
| 156 | ->end() |
||
| 157 | ->end(); |
||
| 158 | |||
| 159 | return $node; |
||
| 160 | } |
||
| 161 | } |
||
| 162 |