Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/SOAP11/Utils/XPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace SimpleSAML\SOAP11\Utils;

use DOMNode;
use DOMXPath;
use Dom;
use SimpleSAML\SOAP11\Constants as C;

/**
Expand All @@ -16,15 +15,15 @@
class XPath extends \SimpleSAML\XPath\XPath
{
/**
* Get a DOMXPath object that can be used to search for SAML elements.
* Get a Dom\XPath object that can be used to search for SAML elements.
*
* @param \DOMNode $node The document to associate to the DOMXPath object.
* @param \Dom\Node $node The document to associate to the Dom\XPath object.
* @param bool $autoregister Whether to auto-register all namespaces used in the document
*
* @return \DOMXPath A DOMXPath object ready to use in the given document, with several
* @return \Dom\XPath A Dom\XPath object ready to use in the given document, with several
* saml-related namespaces already registered.
*/
public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath
public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath
{
$xp = parent::getXPath($node, $autoregister);

Expand Down
14 changes: 7 additions & 7 deletions src/SOAP11/XML/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SOAP11\XML;

use DOMElement;
use Dom;
use SimpleSAML\SOAP11\Assert\Assert;
use SimpleSAML\SOAP11\Exception\ProtocolViolationException;
use SimpleSAML\XML\ExtendableAttributesTrait;
Expand All @@ -16,7 +16,7 @@

use function array_diff;
use function array_filter;
use function array_pop;
use function array_last;
use function array_values;

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct(array $children = [], array $namespacedAttributes =
}));
Assert::maxCount($fault, 1, ProtocolViolationException::class);

$this->setFault(array_pop($fault));
$this->setFault(array_last($fault));
$this->setElements(array_diff($children, $fault));
$this->setAttributesNS($namespacedAttributes);
}
Expand Down Expand Up @@ -97,12 +97,12 @@ public function isEmptyElement(): bool
/*
* Convert XML into an Body element
*
* @param \DOMElement $xml The XML element we should load
* @param \Dom\Element $xml The XML element we should load
*
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, 'Body', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, Body::NS, InvalidDOMElementException::class);
Expand All @@ -117,9 +117,9 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this Body to XML.
*
* @param \DOMElement|null $parent The element we should add this Body to.
* @param \Dom\Element|null $parent The element we should add this Body to.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
10 changes: 5 additions & 5 deletions src/SOAP11/XML/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SOAP11\XML;

use DOMElement;
use Dom;
use SimpleSAML\SOAP11\Assert\Assert;
use SimpleSAML\XML\AbstractElement;
use SimpleSAML\XML\ExtendableAttributesTrait;
Expand Down Expand Up @@ -61,12 +61,12 @@ public function isEmptyElement(): bool
/*
* Convert XML into an Detail element
*
* @param \DOMElement $xml The XML element we should load
* @param \Dom\Element $xml The XML element we should load
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, 'detail', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, Detail::NS, InvalidDOMElementException::class);
Expand All @@ -81,9 +81,9 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this Detail to XML.
*
* @param \DOMElement|null $parent The element we should add this Detail to.
* @param \Dom\Element|null $parent The element we should add this Detail to.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
16 changes: 9 additions & 7 deletions src/SOAP11/XML/Envelope.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SOAP11\XML;

use DOMElement;
use Dom;
use SimpleSAML\SOAP11\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\ExtendableElementTrait;
Expand All @@ -15,6 +15,8 @@
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;
use SimpleSAML\XMLSchema\XML\Constants\NS;

use function array_last;

/**
* Class representing a SOAP-ENV:Envelope element.
*
Expand Down Expand Up @@ -74,12 +76,12 @@ public function getHeader(): ?Header
/**
* Convert XML into an Envelope element
*
* @param \DOMElement $xml The XML element we should load
* @param \Dom\Element $xml The XML element we should load
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, 'Envelope', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, Envelope::NS, InvalidDOMElementException::class);
Expand All @@ -91,8 +93,8 @@ public static function fromXML(DOMElement $xml): static
Assert::maxCount($header, 1, 'Cannot process more than one Header element.', TooManyElementsException::class);

return new static(
array_pop($body),
empty($header) ? null : array_pop($header),
array_last($body),
array_last($header),
self::getChildElementsFromXML($xml),
self::getAttributesNSFromXML($xml),
);
Expand All @@ -102,9 +104,9 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this Envelope to XML.
*
* @param \DOMElement|null $parent The element we should add this envelope to.
* @param \Dom\Element|null $parent The element we should add this envelope to.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
20 changes: 11 additions & 9 deletions src/SOAP11/XML/Fault.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

namespace SimpleSAML\SOAP11\XML;

use DOMElement;
use Dom;
use SimpleSAML\SOAP11\Assert\Assert;
use SimpleSAML\XML\SchemaValidatableElementInterface;
use SimpleSAML\XML\SchemaValidatableElementTrait;
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\Exception\MissingElementException;
use SimpleSAML\XMLSchema\Exception\TooManyElementsException;

use function array_last;

/**
* Class representing a SOAP-ENV:Fault element.
*
Expand Down Expand Up @@ -78,12 +80,12 @@ public function getDetail(): ?Detail
/**
* Convert XML into an Fault element
*
* @param \DOMElement $xml The XML element we should load
* @param \Dom\Element $xml The XML element we should load
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, 'Fault', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, Fault::NS, InvalidDOMElementException::class);
Expand All @@ -106,20 +108,20 @@ public static function fromXML(DOMElement $xml): static
Assert::maxCount($detail, 1, 'Cannot process more than one detail element.', TooManyElementsException::class);

return new self(
array_pop($faultCode),
array_pop($faultString),
array_pop($faultActor),
array_pop($detail),
array_last($faultCode),
array_last($faultString),
array_last($faultActor),
array_last($detail),
);
}


/**
* Convert this Fault to XML.
*
* @param \DOMElement|null $parent The element we should add this fault to.
* @param \Dom\Element|null $parent The element we should add this fault to.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
10 changes: 5 additions & 5 deletions src/SOAP11/XML/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SOAP11\XML;

use DOMElement;
use Dom;
use SimpleSAML\SOAP11\Assert\Assert;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\ExtendableElementTrait;
Expand Down Expand Up @@ -57,12 +57,12 @@ public function isEmptyElement(): bool
/*
* Convert XML into an Header element
*
* @param \DOMElement $xml The XML element we should load
* @param \Dom\Element $xml The XML element we should load
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, 'Header', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, Header::NS, InvalidDOMElementException::class);
Expand All @@ -77,9 +77,9 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this Header to XML.
*
* @param \DOMElement|null $parent The element we should add this header to.
* @param \Dom\Element|null $parent The element we should add this header to.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
11 changes: 5 additions & 6 deletions src/SOAP12/Utils/XPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace SimpleSAML\SOAP12\Utils;

use DOMNode;
use DOMXPath;
use Dom;
use SimpleSAML\SOAP12\Constants as C;

/**
Expand All @@ -16,15 +15,15 @@
class XPath extends \SimpleSAML\XPath\XPath
{
/**
* Get a DOMXPath object that can be used to search for SAML elements.
* Get a Dom\XPath object that can be used to search for SAML elements.
*
* @param \DOMNode $node The document to associate to the DOMXPath object.
* @param \Dom\Node $node The document to associate to the Dom\XPath object.
* @param bool $autoregister Whether to auto-register all namespaces used in the document
*
* @return \DOMXPath A DOMXPath object ready to use in the given document, with several
* @return \Dom\XPath A Dom\XPath object ready to use in the given document, with several
* saml-related namespaces already registered.
*/
public static function getXPath(DOMNode $node, bool $autoregister = false): DOMXPath
public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath
{
$xp = parent::getXPath($node, $autoregister);

Expand Down
14 changes: 7 additions & 7 deletions src/SOAP12/XML/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SimpleSAML\SOAP12\XML;

use DOMElement;
use Dom;
use SimpleSAML\SOAP12\Assert\Assert;
use SimpleSAML\SOAP12\Exception\ProtocolViolationException;
use SimpleSAML\XML\ExtendableAttributesTrait;
Expand All @@ -14,7 +14,7 @@
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use SimpleSAML\XMLSchema\XML\Constants\NS;

use function array_pop;
use function array_last;

/**
* Class representing a env:Body element.
Expand Down Expand Up @@ -86,12 +86,12 @@ public function isEmptyElement(): bool
/*
* Convert XML into an Body element
*
* @param \DOMElement $xml The XML element we should load
* @param \Dom\Element $xml The XML element we should load
*
* @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
* If the qualified name of the supplied element is wrong
*/
public static function fromXML(DOMElement $xml): static
public static function fromXML(Dom\Element $xml): static
{
Assert::same($xml->localName, 'Body', InvalidDOMElementException::class);
Assert::same($xml->namespaceURI, Body::NS, InvalidDOMElementException::class);
Expand All @@ -104,7 +104,7 @@ public static function fromXML(DOMElement $xml): static
Assert::maxCount($fault, 1, ProtocolViolationException::class);

return new static(
array_pop($fault),
array_last($fault),
self::getChildElementsFromXML($xml),
self::getAttributesNSFromXML($xml),
);
Expand All @@ -114,9 +114,9 @@ public static function fromXML(DOMElement $xml): static
/**
* Convert this Body to XML.
*
* @param \DOMElement|null $parent The element we should add this Body to.
* @param \Dom\Element|null $parent The element we should add this Body to.
*/
public function toXML(?DOMElement $parent = null): DOMElement
public function toXML(?Dom\Element $parent = null): Dom\Element
{
$e = $this->instantiateParentElement($parent);

Expand Down
Loading
Loading