Skip to content

Commit

Permalink
Fix quality checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jul 23, 2024
1 parent 4592fff commit 71560b3
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions src/SAML2/XML/md/NameIDFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,6 @@ public function __construct(string $content)
}


/**
* Get the content of the element.
*
* @return string
*/
public function getContent(): string
{
return $this->sanitizeContent($this->getRawContent());
}


/**
* Get the raw and unsanitized content of the element.
*
* @return string
*/
public function getRawContent(): string
{
return $this->content;
}


/**
* Sanitize the content of the element.
*
* @param string $content The unsanitized textContent
* @throws \Exception on failure
* @return string
*/
protected function sanitizeContent(string $content): string
{
// We've seen metadata in the wild that had stray whitespace around URIs, causing assertions to fail
return trim($content);
}


/**
* Validate the content of the element.
*
Expand Down Expand Up @@ -94,6 +58,6 @@ public static function fromXML(DOMElement $xml): static
Assert::same($xml->localName, 'NameIDFormat', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, NameIDFormat::NS, InvalidDOMElementException::class);

return new static($xml->textContent);
return new static(trim($xml->textContent));
}
}

0 comments on commit 71560b3

Please sign in to comment.