Conditions | 1 |
Paths | 1 |
Total Lines | 66 |
Code Lines | 64 |
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 |
||
60 | public function getNodeDefinition(NodeDefinition $node) |
||
61 | { |
||
62 | $node->children() |
||
63 | ->arrayNode($this->name()) |
||
64 | ->treatNullLike([]) |
||
65 | ->treatFalseLike([]) |
||
66 | ->useAttributeAsKey('name') |
||
67 | ->arrayPrototype() |
||
68 | ->children() |
||
69 | ->booleanNode('is_public') |
||
70 | ->info('If true, the service will be public, else private.') |
||
71 | ->defaultTrue() |
||
72 | ->end() |
||
73 | ->arrayNode('signature_algorithms') |
||
74 | ->info('A list of signature algorithm aliases.') |
||
75 | ->useAttributeAsKey('name') |
||
76 | ->isRequired() |
||
77 | ->scalarPrototype()->end() |
||
78 | ->end() |
||
79 | ->arrayNode('key_encryption_algorithms') |
||
80 | ->info('A list of key encryption algorithm aliases.') |
||
81 | ->useAttributeAsKey('name') |
||
82 | ->isRequired() |
||
83 | ->scalarPrototype()->end() |
||
84 | ->end() |
||
85 | ->arrayNode('content_encryption_algorithms') |
||
86 | ->info('A list of key encryption algorithm aliases.') |
||
87 | ->useAttributeAsKey('name') |
||
88 | ->isRequired() |
||
89 | ->scalarPrototype()->end() |
||
90 | ->end() |
||
91 | ->arrayNode('compression_methods') |
||
92 | ->info('A list of compression method aliases.') |
||
93 | ->useAttributeAsKey('name') |
||
94 | ->defaultValue(['DEF']) |
||
95 | ->scalarPrototype()->end() |
||
96 | ->end() |
||
97 | ->arrayNode('jws_serializers') |
||
98 | ->info('A list of JWS serializer aliases.') |
||
99 | ->useAttributeAsKey('name') |
||
100 | ->treatNullLike([]) |
||
101 | ->treatFalseLike([]) |
||
102 | ->isRequired() |
||
103 | ->requiresAtLeastOneElement() |
||
104 | ->scalarPrototype()->end() |
||
105 | ->end() |
||
106 | ->arrayNode('jwe_serializers') |
||
107 | ->info('A list of JWE serializer aliases.') |
||
108 | ->useAttributeAsKey('name') |
||
109 | ->treatNullLike([]) |
||
110 | ->treatFalseLike([]) |
||
111 | ->isRequired() |
||
112 | ->requiresAtLeastOneElement() |
||
113 | ->scalarPrototype()->end() |
||
114 | ->end() |
||
115 | ->arrayNode('tags') |
||
116 | ->info('A list of tags to be associated to the service.') |
||
117 | ->useAttributeAsKey('name') |
||
118 | ->treatNullLike([]) |
||
119 | ->treatFalseLike([]) |
||
120 | ->variablePrototype()->end() |
||
121 | ->end() |
||
122 | ->end() |
||
123 | ->end() |
||
124 | ->end(); |
||
125 | } |
||
126 | |||
135 |