| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 105 | 
| Code Lines | 102 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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 | ||
| 86 |   public function configure(ArrayNodeDefinition $builder) { | ||
| 87 | $builder-> | ||
| 88 | children()-> | ||
| 89 |         scalarNode('default_driver')-> | ||
| 90 |           defaultValue('blackbox')-> | ||
| 91 |           info('Use "blackbox" to test remote site. See "api_driver" for easier integration.')-> | ||
| 92 | end()-> | ||
| 93 |         scalarNode('api_driver')-> | ||
| 94 |           defaultValue('drush')-> | ||
| 95 |           info('Bootstraps drupal through "drupal8" or "drush".')-> | ||
| 96 | end()-> | ||
| 97 |         scalarNode('drush_driver')-> | ||
| 98 |           defaultValue('drush')-> | ||
| 99 | end()-> | ||
| 100 |         arrayNode('region_map')-> | ||
| 101 |           info("Targeting content in specific regions can be accomplished once those regions have been defined." . PHP_EOL | ||
| 102 | . ' My region: "#css-selector"' . PHP_EOL | ||
| 103 | . ' Content: "#main .region-content"'. PHP_EOL | ||
| 104 | . ' Right sidebar: "#sidebar-second"'. PHP_EOL | ||
| 105 | )-> | ||
| 106 |           useAttributeAsKey('key')-> | ||
| 107 |           prototype('variable')-> | ||
| 108 | end()-> | ||
| 109 | end()-> | ||
| 110 |         arrayNode('text')-> | ||
| 111 | info( | ||
| 112 | 'Text strings, such as Log out or the Username field can be altered via behat.yml if they vary from the default values.' . PHP_EOL | ||
| 113 | . ' log_out: "Sign out"' . PHP_EOL | ||
| 114 | . ' log_in: "Sign in"' . PHP_EOL | ||
| 115 | . ' password_field: "Enter your password"' . PHP_EOL | ||
| 116 | . ' username_field: "Nickname"' | ||
| 117 | )-> | ||
| 118 | addDefaultsIfNotSet()-> | ||
| 119 | children()-> | ||
| 120 |             scalarNode('log_in')-> | ||
| 121 |               defaultValue('Log in')-> | ||
| 122 | end()-> | ||
| 123 |             scalarNode('log_out')-> | ||
| 124 |               defaultValue('Log out')-> | ||
| 125 | end()-> | ||
| 126 |             scalarNode('password_field')-> | ||
| 127 |               defaultValue('Password')-> | ||
| 128 | end()-> | ||
| 129 |             scalarNode('username_field')-> | ||
| 130 |               defaultValue('Username')-> | ||
| 131 | end()-> | ||
| 132 | end()-> | ||
| 133 | end()-> | ||
| 134 |         arrayNode('selectors')-> | ||
| 135 | addDefaultsIfNotSet()-> | ||
| 136 | children()-> | ||
| 137 |             scalarNode('message_selector')->end()-> | ||
| 138 |             scalarNode('error_message_selector')->end()-> | ||
| 139 |             scalarNode('success_message_selector')->end()-> | ||
| 140 |             scalarNode('warning_message_selector')->end()-> | ||
| 141 |             scalarNode('login_form_selector')-> | ||
| 142 |               defaultValue('form#user-login')-> | ||
| 143 | end()-> | ||
| 144 |             scalarNode('logged_in_selector')-> | ||
| 145 |               defaultValue('body.logged-in,body.user-logged-in')-> | ||
| 146 | end()-> | ||
| 147 | end()-> | ||
| 148 | end()-> | ||
| 149 | // Drupal drivers. | ||
| 150 |         arrayNode('blackbox')-> | ||
| 151 | end()-> | ||
| 152 |         arrayNode('drupal')-> | ||
| 153 | children()-> | ||
| 154 |             scalarNode('drupal_root')->end()-> | ||
| 155 | end()-> | ||
| 156 | end()-> | ||
| 157 |         arrayNode('drush')-> | ||
| 158 | children()-> | ||
| 159 |             scalarNode('alias')->end()-> | ||
| 160 |             scalarNode('binary')->defaultValue('drush')->end()-> | ||
| 161 |             scalarNode('root')->end()-> | ||
| 162 |             scalarNode('global_options')->end()-> | ||
| 163 | end()-> | ||
| 164 | end()-> | ||
| 165 | // Subcontext paths. | ||
| 166 |         arrayNode('subcontexts')-> | ||
| 167 | info( | ||
| 168 | 'The Drupal Extension is capable of discovering additional step-definitions provided by subcontexts.' . PHP_EOL | ||
| 169 | . 'Module authors can provide these in files following the naming convention of foo.behat.inc. Once that module is enabled, the Drupal Extension will load these.' . PHP_EOL | ||
| 170 | . PHP_EOL | ||
| 171 | . 'Additional subcontexts can be loaded by either placing them in the bootstrap directory (typically features/bootstrap) or by adding them to behat.yml.' | ||
| 172 | )-> | ||
| 173 | addDefaultsIfNotSet()-> | ||
| 174 | children()-> | ||
| 175 |             arrayNode('paths')-> | ||
| 176 | info( | ||
| 177 | '- /path/to/additional/subcontexts' . PHP_EOL | ||
| 178 | . '- /another/path' | ||
| 179 | )-> | ||
| 180 |               useAttributeAsKey('key')-> | ||
| 181 |               prototype('variable')->end()-> | ||
| 182 | end()-> | ||
| 183 |             scalarNode('autoload')-> | ||
| 184 | defaultValue(TRUE)-> | ||
| 185 | end()-> | ||
| 186 | end()-> | ||
| 187 | end()-> | ||
| 188 | end()-> | ||
| 189 | end(); | ||
| 190 | } | ||
| 191 | |||
| 294 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.