Conditions | 18 |
Paths | 8193 |
Total Lines | 59 |
Code Lines | 39 |
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 |
||
36 | public function denormalize($data, $class, $format = null, array $context = []) |
||
37 | { |
||
38 | if (!is_object($data)) { |
||
39 | throw new InvalidArgumentException(); |
||
40 | } |
||
41 | $object = new \Montross50\NetsparkerCloud\SDK\Model\FormAuthenticationSettingModel(); |
||
42 | if (property_exists($data, 'CustomScripts')) { |
||
43 | $values = []; |
||
44 | foreach ($data->{'CustomScripts'} as $value) { |
||
45 | $values[] = $this->denormalizer->denormalize($value, 'Montross50\\NetsparkerCloud\\SDK\\Model\\FormAuthenticationCustomScript', 'json', $context); |
||
46 | } |
||
47 | $object->setCustomScripts($values); |
||
48 | } |
||
49 | if (property_exists($data, 'DefaultPersonaValidation')) { |
||
50 | $object->setDefaultPersonaValidation($data->{'DefaultPersonaValidation'}); |
||
51 | } |
||
52 | if (property_exists($data, 'DetectBearerToken')) { |
||
53 | $object->setDetectBearerToken($data->{'DetectBearerToken'}); |
||
54 | } |
||
55 | if (property_exists($data, 'DisableLogoutDetection')) { |
||
56 | $object->setDisableLogoutDetection($data->{'DisableLogoutDetection'}); |
||
57 | } |
||
58 | if (property_exists($data, 'IsEnabled')) { |
||
59 | $object->setIsEnabled($data->{'IsEnabled'}); |
||
60 | } |
||
61 | if (property_exists($data, 'LoginFormUrl')) { |
||
62 | $object->setLoginFormUrl($data->{'LoginFormUrl'}); |
||
63 | } |
||
64 | if (property_exists($data, 'LoginRequiredUrl')) { |
||
65 | $object->setLoginRequiredUrl($data->{'LoginRequiredUrl'}); |
||
66 | } |
||
67 | if (property_exists($data, 'LogoutKeywordPatterns')) { |
||
68 | $values_1 = []; |
||
69 | foreach ($data->{'LogoutKeywordPatterns'} as $value_1) { |
||
70 | $values_1[] = $this->denormalizer->denormalize($value_1, 'Montross50\\NetsparkerCloud\\SDK\\Model\\LogoutKeywordPatternModel', 'json', $context); |
||
71 | } |
||
72 | $object->setLogoutKeywordPatterns($values_1); |
||
73 | } |
||
74 | if (property_exists($data, 'LogoutKeywordPatternsValue')) { |
||
75 | $object->setLogoutKeywordPatternsValue($data->{'LogoutKeywordPatternsValue'}); |
||
76 | } |
||
77 | if (property_exists($data, 'LogoutRedirectPattern')) { |
||
78 | $object->setLogoutRedirectPattern($data->{'LogoutRedirectPattern'}); |
||
79 | } |
||
80 | if (property_exists($data, 'OverrideTargetUrl')) { |
||
81 | $object->setOverrideTargetUrl($data->{'OverrideTargetUrl'}); |
||
82 | } |
||
83 | if (property_exists($data, 'Personas')) { |
||
84 | $values_2 = []; |
||
85 | foreach ($data->{'Personas'} as $value_2) { |
||
86 | $values_2[] = $this->denormalizer->denormalize($value_2, 'Montross50\\NetsparkerCloud\\SDK\\Model\\FormAuthenticationPersona', 'json', $context); |
||
87 | } |
||
88 | $object->setPersonas($values_2); |
||
89 | } |
||
90 | if (property_exists($data, 'PersonasValidation')) { |
||
91 | $object->setPersonasValidation($data->{'PersonasValidation'}); |
||
92 | } |
||
93 | |||
94 | return $object; |
||
95 | } |
||
155 |