| Conditions | 1 |
| Paths | 1 |
| Total Lines | 76 |
| Code Lines | 72 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 7 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 13 | public function getConfigTreeBuilder() |
||
| 14 | { |
||
| 15 | $treeBuilder = new TreeBuilder(); |
||
| 16 | $rootNode = $treeBuilder->root('skautis'); |
||
| 17 | |||
| 18 | $rootNode->children() |
||
| 19 | ->scalarNode('app_id') |
||
| 20 | ->isRequired() |
||
| 21 | ->info("Skautis app id") |
||
| 22 | ->end() |
||
| 23 | ->booleanNode('test_mode') |
||
| 24 | ->defaultValue(true) |
||
| 25 | ->isRequired() |
||
| 26 | ->info("Use test-is.skaut.cz") |
||
| 27 | ->end() |
||
| 28 | ->booleanNode('profiler') |
||
| 29 | ->defaultValue('%kernel.debug%') |
||
| 30 | ->info("Gather data for profiler") |
||
| 31 | ->end() |
||
| 32 | ->booleanNode('wsdl_compression') |
||
| 33 | ->defaultValue(true) |
||
| 34 | ->info("Enable WSDL compression") |
||
| 35 | ->end() |
||
| 36 | ->booleanNode('wsdl_cache') |
||
| 37 | ->defaultValue(false) |
||
| 38 | ->info("Enable wsdl cache") |
||
| 39 | ->end() |
||
| 40 | ->scalarNode('doctrine_cache_provider') |
||
| 41 | ->defaultValue('') |
||
| 42 | ->info("Doctrine cache provider") |
||
| 43 | ->end() |
||
| 44 | ->booleanNode('request_cache') |
||
| 45 | ->defaultValue(false) |
||
| 46 | ->info("Use request cache") |
||
| 47 | ->end() |
||
| 48 | ->integerNode('request_cache_ttl') |
||
| 49 | ->defaultValue(0) |
||
| 50 | ->info("Request cache time to live") |
||
| 51 | ->end() |
||
| 52 | ->scalarNode('after_login_redirect') |
||
| 53 | ->defaultValue('homepage') |
||
| 54 | ->info("Route to be redirected to after login") |
||
| 55 | ->end() |
||
| 56 | ->scalarNode('after_logout_redirect') |
||
| 57 | ->defaultValue('homepage') |
||
| 58 | ->info("Route to be redirected to after logout") |
||
| 59 | ->end() |
||
| 60 | ->arrayNode("auth")->children() |
||
| 61 | ->booleanNode("enable_connector") |
||
| 62 | ->info("Enable connecting users from Skautis to Users in application") |
||
| 63 | ->defaultValue(false) |
||
| 64 | ->end() |
||
| 65 | ->scalarNode('connector_service') |
||
| 66 | ->defaultValue('') |
||
| 67 | ->info("Name of service implementing UserConnectorInterface") |
||
| 68 | ->end() |
||
| 69 | ->booleanNode("enable_autoregister") |
||
| 70 | ->defaultValue(false) |
||
| 71 | ->info("Enable automatic registering of users from SkautIS") |
||
| 72 | ->end() |
||
| 73 | ->scalarNode('registrator_service') |
||
| 74 | ->defaultValue('') |
||
| 75 | ->info("Name of service implementing UserRegistratorInterface") |
||
| 76 | ->end() |
||
| 77 | ->booleanNode("enable_skautis_anonymous") |
||
| 78 | ->defaultValue(false) |
||
| 79 | ->info("Login users to Symfony who has account at Skautis only") |
||
| 80 | ->end() |
||
| 81 | ->booleanNode("force_confirm_auth") |
||
| 82 | ->defaultValue(true) |
||
| 83 | ->info("Verify login via request to SkautIS server on each access") |
||
| 84 | ->end() |
||
| 85 | ->end(); |
||
| 86 | |||
| 87 | return $treeBuilder; |
||
| 88 | } |
||
| 89 | } |
||
| 90 |