Conditions | 21 |
Paths | > 20000 |
Total Lines | 65 |
Code Lines | 42 |
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 |
||
106 | public function normalize($object, $format = null, array $context = []) |
||
107 | { |
||
108 | $data = new \stdClass(); |
||
109 | if (null !== $object->getBailThreshold()) { |
||
110 | $data->{'BailThreshold'} = $object->getBailThreshold(); |
||
111 | } |
||
112 | if (null !== $object->getConfirmOpenRedirectSimulateTimeout()) { |
||
113 | $data->{'ConfirmOpenRedirectSimulateTimeout'} = $object->getConfirmOpenRedirectSimulateTimeout(); |
||
114 | } |
||
115 | if (null !== $object->getConfirmXssSimulateTimeout()) { |
||
116 | $data->{'ConfirmXssSimulateTimeout'} = $object->getConfirmXssSimulateTimeout(); |
||
117 | } |
||
118 | if (null !== $object->getDomParserAllowOutOfScopeXmlHttpRequests()) { |
||
119 | $data->{'DomParserAllowOutOfScopeXmlHttpRequests'} = $object->getDomParserAllowOutOfScopeXmlHttpRequests(); |
||
120 | } |
||
121 | if (null !== $object->getDomParserDfsLimit()) { |
||
122 | $data->{'DomParserDfsLimit'} = $object->getDomParserDfsLimit(); |
||
123 | } |
||
124 | if (null !== $object->getDomParserDotify()) { |
||
125 | $data->{'DomParserDotify'} = $object->getDomParserDotify(); |
||
126 | } |
||
127 | if (null !== $object->getDomParserExclusionCssSelector()) { |
||
128 | $data->{'DomParserExclusionCssSelector'} = $object->getDomParserExclusionCssSelector(); |
||
129 | } |
||
130 | if (null !== $object->getDomParserExtractResources()) { |
||
131 | $data->{'DomParserExtractResources'} = $object->getDomParserExtractResources(); |
||
132 | } |
||
133 | if (null !== $object->getDomParserFilterColonEvents()) { |
||
134 | $data->{'DomParserFilterColonEvents'} = $object->getDomParserFilterColonEvents(); |
||
135 | } |
||
136 | if (null !== $object->getDomParserFilterDocumentEvents()) { |
||
137 | $data->{'DomParserFilterDocumentEvents'} = $object->getDomParserFilterDocumentEvents(); |
||
138 | } |
||
139 | if (null !== $object->getDomParserIgnoreDocumentEvents()) { |
||
140 | $data->{'DomParserIgnoreDocumentEvents'} = $object->getDomParserIgnoreDocumentEvents(); |
||
141 | } |
||
142 | if (null !== $object->getDomParserLoadUrlTimeout()) { |
||
143 | $data->{'DomParserLoadUrlTimeout'} = $object->getDomParserLoadUrlTimeout(); |
||
144 | } |
||
145 | if (null !== $object->getDomParserMaxOptionElementsPerSelect()) { |
||
146 | $data->{'DomParserMaxOptionElementsPerSelect'} = $object->getDomParserMaxOptionElementsPerSelect(); |
||
147 | } |
||
148 | if (null !== $object->getDomParserPersistentJavaScriptCookies()) { |
||
149 | $data->{'DomParserPersistentJavaScriptCookies'} = $object->getDomParserPersistentJavaScriptCookies(); |
||
150 | } |
||
151 | if (null !== $object->getDomParserPreSimulateWait()) { |
||
152 | $data->{'DomParserPreSimulateWait'} = $object->getDomParserPreSimulateWait(); |
||
153 | } |
||
154 | if (null !== $object->getDomParserSimulationTimeout()) { |
||
155 | $data->{'DomParserSimulationTimeout'} = $object->getDomParserSimulationTimeout(); |
||
156 | } |
||
157 | if (null !== $object->getEnableDomParser()) { |
||
158 | $data->{'EnableDomParser'} = $object->getEnableDomParser(); |
||
159 | } |
||
160 | if (null !== $object->getIntereventTimeout()) { |
||
161 | $data->{'IntereventTimeout'} = $object->getIntereventTimeout(); |
||
162 | } |
||
163 | if (null !== $object->getSkipElementCount()) { |
||
164 | $data->{'SkipElementCount'} = $object->getSkipElementCount(); |
||
165 | } |
||
166 | if (null !== $object->getSkipThreshold()) { |
||
167 | $data->{'SkipThreshold'} = $object->getSkipThreshold(); |
||
168 | } |
||
169 | |||
170 | return $data; |
||
171 | } |
||
173 |