Conditions | 1 |
Paths | 1 |
Total 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 |
||
32 | public function getConfigTreeBuilder() |
||
33 | { |
||
34 | $treeBuilder = new TreeBuilder; |
||
35 | |||
36 | $rootNode = $treeBuilder->root('surfnet_bundle'); |
||
|
|||
37 | $rootNode |
||
38 | ->children() |
||
39 | ->arrayNode('logging') |
||
40 | ->isRequired() |
||
41 | ->children() |
||
42 | ->scalarNode('application_name') |
||
43 | ->info('This is the application name that is included with each log message') |
||
44 | ->isRequired() |
||
45 | ->validate() |
||
46 | ->ifTrue(function ($name) { |
||
47 | return !is_string($name); |
||
48 | }) |
||
49 | ->thenInvalid('surfnet_bundle.logging.application_name must be string') |
||
50 | ->end() |
||
51 | ->end() |
||
52 | ->end() |
||
53 | ->end() |
||
54 | ->arrayNode('loa_definition') |
||
55 | ->canBeDisabled() |
||
56 | ->children() |
||
57 | ->scalarNode('loa1') |
||
58 | ->example('https://gateway.tld/authentication/loa1') |
||
59 | ->validate() |
||
60 | ->ifTrue(function ($value) { |
||
61 | return !is_string($value); |
||
62 | }) |
||
63 | ->thenInvalid('Loa definition for "loa1" must be a string') |
||
64 | ->end() |
||
65 | ->end() |
||
66 | ->scalarNode('loa2') |
||
67 | ->example('https://gateway.tld/authentication/loa2') |
||
68 | ->validate() |
||
69 | ->ifTrue(function ($value) { |
||
70 | return !is_string($value); |
||
71 | }) |
||
72 | ->thenInvalid('Loa definition for "loa2" must be a string') |
||
73 | ->end() |
||
74 | ->end() |
||
75 | ->scalarNode('loa3') |
||
76 | ->example('https://gateway.tld/authentication/loa3') |
||
77 | ->validate() |
||
78 | ->ifTrue(function ($value) { |
||
79 | return !is_string($value); |
||
80 | }) |
||
81 | ->thenInvalid('Loa definition for "loa3" must be a string') |
||
82 | ->end() |
||
83 | ->end() |
||
84 | ->end() |
||
85 | ->end() |
||
86 | ->arrayNode('attach_request_id_injector_to') |
||
87 | ->prototype('scalar') |
||
88 | ->validate() |
||
89 | ->ifTrue(function ($serviceId) { return !is_string($serviceId); }) |
||
90 | ->thenInvalid('surfnet_bundle.attach_request_id_injector_to must be array of strings') |
||
91 | ->end() |
||
92 | ->end() |
||
93 | ->end(); |
||
94 | |||
95 | $this->createGatewayApiConfiguration($rootNode); |
||
96 | $this->createSmsConfiguration($rootNode); |
||
97 | $this->createLocaleCookieConfiguration($rootNode); |
||
98 | |||
99 | return $treeBuilder; |
||
100 | } |
||
101 | |||
254 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.