/** * @param string $nameIdFormat * @throws \InvalidArgumentException */ public function setNameIdFormat($nameIdFormat) { if (!NameIDPolicy::isValid($nameIdFormat)) { throw new \InvalidArgumentException('Invalid NameIDFormat ' . $nameIdFormat); } $this->nameIdFormat = $nameIdFormat; }
/** * @param string $value * @throws \InvalidArgumentException * @return $this|NameIDFormat */ public function setValue($value) { $value = trim($value); if ($value && false == NameIDPolicy::isValid($value)) { throw new \InvalidArgumentException(sprintf("Invalid NameIDFormat '%s'", $value)); } $this->value = $value; return $this; }
protected function prepareForXml() { parent::prepareForXml(); if (!$this->getAssertionConsumerServiceURL()) { throw new InvalidRequestException('AuthRequest AssertionConsumerServiceURL not set'); } if (!$this->getProtocolBinding()) { throw new InvalidRequestException('AuthnRequest ProtocolBinding not set'); } if (!NameIDPolicy::isValid($this->getNameIdPolicyFormat())) { throw new InvalidRequestException('AuthnRequest NameIDPolicy Format not set'); } }