| Conditions | 17 |
| Paths | 8192 |
| Total Lines | 56 |
| Code Lines | 37 |
| 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 |
||
| 97 | public function normalize($object, $format = null, array $context = []) |
||
| 98 | { |
||
| 99 | $data = new \stdClass(); |
||
| 100 | if (null !== $object->getCustomScripts()) { |
||
| 101 | $values = []; |
||
| 102 | foreach ($object->getCustomScripts() as $value) { |
||
| 103 | $values[] = $this->normalizer->normalize($value, 'json', $context); |
||
| 104 | } |
||
| 105 | $data->{'CustomScripts'} = $values; |
||
| 106 | } |
||
| 107 | if (null !== $object->getDefaultPersonaValidation()) { |
||
| 108 | $data->{'DefaultPersonaValidation'} = $object->getDefaultPersonaValidation(); |
||
| 109 | } |
||
| 110 | if (null !== $object->getDetectBearerToken()) { |
||
| 111 | $data->{'DetectBearerToken'} = $object->getDetectBearerToken(); |
||
| 112 | } |
||
| 113 | if (null !== $object->getDisableLogoutDetection()) { |
||
| 114 | $data->{'DisableLogoutDetection'} = $object->getDisableLogoutDetection(); |
||
| 115 | } |
||
| 116 | if (null !== $object->getIsEnabled()) { |
||
| 117 | $data->{'IsEnabled'} = $object->getIsEnabled(); |
||
| 118 | } |
||
| 119 | if (null !== $object->getLoginFormUrl()) { |
||
| 120 | $data->{'LoginFormUrl'} = $object->getLoginFormUrl(); |
||
| 121 | } |
||
| 122 | if (null !== $object->getLoginRequiredUrl()) { |
||
| 123 | $data->{'LoginRequiredUrl'} = $object->getLoginRequiredUrl(); |
||
| 124 | } |
||
| 125 | if (null !== $object->getLogoutKeywordPatterns()) { |
||
| 126 | $values_1 = []; |
||
| 127 | foreach ($object->getLogoutKeywordPatterns() as $value_1) { |
||
| 128 | $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); |
||
| 129 | } |
||
| 130 | $data->{'LogoutKeywordPatterns'} = $values_1; |
||
| 131 | } |
||
| 132 | if (null !== $object->getLogoutKeywordPatternsValue()) { |
||
| 133 | $data->{'LogoutKeywordPatternsValue'} = $object->getLogoutKeywordPatternsValue(); |
||
| 134 | } |
||
| 135 | if (null !== $object->getLogoutRedirectPattern()) { |
||
| 136 | $data->{'LogoutRedirectPattern'} = $object->getLogoutRedirectPattern(); |
||
| 137 | } |
||
| 138 | if (null !== $object->getOverrideTargetUrl()) { |
||
| 139 | $data->{'OverrideTargetUrl'} = $object->getOverrideTargetUrl(); |
||
| 140 | } |
||
| 141 | if (null !== $object->getPersonas()) { |
||
| 142 | $values_2 = []; |
||
| 143 | foreach ($object->getPersonas() as $value_2) { |
||
| 144 | $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); |
||
| 145 | } |
||
| 146 | $data->{'Personas'} = $values_2; |
||
| 147 | } |
||
| 148 | if (null !== $object->getPersonasValidation()) { |
||
| 149 | $data->{'PersonasValidation'} = $object->getPersonasValidation(); |
||
| 150 | } |
||
| 151 | |||
| 152 | return $data; |
||
| 153 | } |
||
| 155 |