Conditions | 1 |
Paths | 1 |
Total Lines | 78 |
Code Lines | 69 |
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')->defaultFalse()->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 | // https://github.com/mozilla/geckodriver#webdriver-capabilities |
||
115 | // https://www.w3.org/TR/webdriver/#dfn-accept-insecure-tls-certificates |
||
116 | ->booleanNode('acceptInsecureCerts')->end() |
||
117 | // https://github.com/mozilla/geckodriver#webdriver-capabilities |
||
118 | ->scalarNode('pageLoadStrategy')->defaultValue('normal')->end() |
||
119 | ->booleanNode('nativeEvents')->end() |
||
120 | ->booleanNode('overlappingCheckDisabled')->end() |
||
121 | ->arrayNode('proxy') |
||
122 | ->children() |
||
123 | ->scalarNode('proxyType')->end() |
||
124 | ->scalarNode('proxyAuthconfigUrl')->end() |
||
125 | ->scalarNode('ftpProxy')->end() |
||
126 | ->scalarNode('httpProxy')->end() |
||
127 | ->scalarNode('sslProxy')->end() |
||
128 | ->end() |
||
129 | ->validate() |
||
130 | ->ifTrue(function ($v) { |
||
131 | return empty($v); |
||
132 | }) |
||
133 | ->thenUnset() |
||
134 | ->end() |
||
135 | ->end() |
||
136 | ->arrayNode('firefox') |
||
137 | ->children() |
||
138 | ->scalarNode('profile') |
||
139 | ->validate() |
||
140 | ->ifTrue(function ($v) { |
||
141 | return !file_exists($v); |
||
142 | }) |
||
143 | ->thenInvalid('Cannot find profile zip file %s') |
||
144 | ->end() |
||
145 | ->end() |
||
146 | ->scalarNode('binary')->end() |
||
147 | ->end() |
||
148 | ->end() |
||
149 | ->arrayNode('chrome') |
||
150 | ->children() |
||
151 | ->arrayNode('switches')->prototype('scalar')->end()->end() |
||
152 | ->scalarNode('binary')->end() |
||
153 | ->arrayNode('extensions')->prototype('scalar')->end()->end() |
||
154 | ->end() |
||
155 | ->end() |
||
156 | ->arrayNode('extra_capabilities') |
||
157 | ->info('Custom capabilities merged with the known ones') |
||
158 | ->normalizeKeys(false) |
||
159 | ->useAttributeAsKey('name') |
||
160 | ->prototype('variable')->end() |
||
161 | ->end() |
||
162 | ->end(); |
||
163 | |||
164 | return $node; |
||
165 | } |
||
166 | } |
||
167 |