Small fix for issue #537 and refactor to make code more clear.
Small fix for issue #537 and refactor to make code more clear.

sgomez/saml2,sitya/saml2,madmatt/saml2,ArtemTeleshev/php-saml2,newmen/saml2,cb8/saml2,simplesamlphp/saml2