| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| Code Lines | 56 |
| 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 |
||
| 94 | private function addLdapDomainsSection(ArrayNodeDefinition $node) |
||
| 95 | { |
||
| 96 | $node |
||
| 97 | ->children() |
||
| 98 | ->arrayNode('domains') |
||
| 99 | ->prototype('array') |
||
| 100 | ->children() |
||
| 101 | ->scalarNode('domain_name')->isRequired() |
||
| 102 | ->info('The FQDN (ie. example.com)')->end() |
||
| 103 | ->scalarNode('username')->isRequired() |
||
| 104 | ->info('The username/DN/SID/GUID to used to connect to LDAP.')->end() |
||
| 105 | ->scalarNode('password')->isRequired() |
||
| 106 | ->info('The password for the username used to connect to LDAP.')->end() |
||
| 107 | ->scalarNode('base_dn') |
||
| 108 | ->info('The base DN used for searches (ie. dc=example,dc=com). This is queried from the RootDSE if not provided.')->end() |
||
| 109 | ->integerNode('port') |
||
| 110 | ->info('The default port number to connect to LDAP on.')->end() |
||
| 111 | ->booleanNode('use_paging') |
||
| 112 | ->info('Whether or not search results should be paged')->end() |
||
| 113 | ->integerNode('page_size') |
||
| 114 | ->info('The size for paged result searches.')->end() |
||
| 115 | ->booleanNode('use_tls') |
||
| 116 | ->info('Encrypt the connection with TLS. This is required when modifying LDAP passwords.')->end() |
||
| 117 | ->booleanNode('use_ssl') |
||
| 118 | ->info('Encrypt the connection with SSL. Typically you want to use "use_tls" and not this option.')->end() |
||
| 119 | ->scalarNode('ldap_type') |
||
| 120 | ->info('The LDAP type for this domain. Choices are ad or openldap.')->end() |
||
| 121 | ->arrayNode('servers') |
||
| 122 | ->info('The LDAP servers to connect to. This is queried from DNS if not provided.') |
||
| 123 | ->beforeNormalization() |
||
| 124 | ->ifTrue(function ($v) { |
||
| 125 | return !is_array($v); |
||
| 126 | }) |
||
| 127 | ->then(function ($v) { |
||
| 128 | return [$v]; |
||
| 129 | }) |
||
| 130 | ->end() |
||
| 131 | ->prototype('scalar')->end() |
||
| 132 | ->end() |
||
| 133 | ->booleanNode('lazy_bind') |
||
| 134 | ->info('If set to true, then the connection will not automatically connect and bind when first created.')->end() |
||
| 135 | ->integerNode('idle_reconnect') |
||
| 136 | ->info('The elapsed time (in seconds) when an idle connection will attempt to reconnect to LDAP.')->end() |
||
| 137 | ->integerNode('connect_timeout') |
||
| 138 | ->info('The elapsed time (in seconds) to wait while attempting the initial connection to LDAP.')->end() |
||
| 139 | ->scalarNode('server_selection') |
||
| 140 | ->info('Determines how the LDAP server is selected. Can be "order" or "random".')->end() |
||
| 141 | ->scalarNode('encoding')->end() |
||
| 142 | ->scalarNode('schema_name') |
||
| 143 | ->info('The schema name to use for this domain')->end() |
||
| 144 | ->scalarNode('bind_format') |
||
| 145 | ->info('Set to a string that determines where the username is placed in a bind attempt: %%username%%,ou=users,dc=foo,dc=bar')->end() |
||
| 146 | ->arrayNode('ldap_options') |
||
| 147 | ->info('Set specific LDAP_OPT_* constants to use. Specify them using their string name as keys along with their values.') |
||
| 148 | ->useAttributeAsKey('name') |
||
| 149 | ->prototype('variable') |
||
| 150 | ->end() |
||
| 151 | ->end() |
||
| 152 | ->end(); |
||
| 153 | } |
||
| 154 | |||
| 237 |