Conditions | 11 |
Paths | 9 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
62 | private function validateAuthnContext(AuthnContext $authnContext) |
||
63 | { |
||
64 | if (false == $authnContext->getAuthnContextClassRef() && |
||
65 | false == $authnContext->getAuthnContextDecl() && |
||
66 | false == $authnContext->getAuthnContextDeclRef() |
||
67 | ) { |
||
68 | throw new LightSamlValidationException('AuthnContext element MUST contain at least one AuthnContextClassRef, AuthnContextDecl or AuthnContextDeclRef element'); |
||
69 | } |
||
70 | |||
71 | if ($authnContext->getAuthnContextClassRef() && |
||
72 | $authnContext->getAuthnContextDecl() && |
||
73 | $authnContext->getAuthnContextDeclRef() |
||
74 | ) { |
||
75 | throw new LightSamlValidationException('AuthnContext MUST NOT contain more than two elements.'); |
||
76 | } |
||
77 | |||
78 | if ($authnContext->getAuthnContextClassRef()) { |
||
79 | if (false == Helper::validateWellFormedUriString($authnContext->getAuthnContextClassRef())) { |
||
80 | throw new LightSamlValidationException('AuthnContextClassRef has a value which is not a wellformed absolute uri'); |
||
81 | } |
||
82 | } |
||
83 | if ($authnContext->getAuthnContextDeclRef()) { |
||
84 | if (false === Helper::validateWellFormedUriString($authnContext->getAuthnContextDeclRef())) { |
||
85 | throw new LightSamlValidationException('AuthnContextDeclRef has a value which is not a wellformed absolute uri'); |
||
86 | } |
||
113 |