public static function createWsSecuritySoapHeader(
        $username,
        $password,
        $passwordDigest = false,
        $addCreated = 0,
        $addExpires = 0,
        $returnSoapHeader = true,
        $mustunderstand = false,
        $actor = null,
        $usernameId = null,
        $addNonce = true,
        $envelopeNamespace = Security::ENV_NAMESPACE
    ) {
        $self = new WsSecurity($username, $password, $passwordDigest, $addCreated, $addExpires, $mustunderstand, $actor, $usernameId, $addNonce, $envelopeNamespace);
        if ($returnSoapHeader) {
            if (!empty($actor)) {
                return new \SoapHeader(Element::NS_WSSE, 'Security', new \SoapVar($self->getSecurity()->toSend(), XSD_ANYXML), $mustunderstand, $actor);
            }

            return new \SoapHeader(Element::NS_WSSE, 'Security', new \SoapVar($self->getSecurity()->toSend(), XSD_ANYXML), $mustunderstand);
        }

        return new \SoapVar($self->getSecurity()->toSend(), XSD_ANYXML);
    }