-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXPath.php
More file actions
36 lines (30 loc) · 1.06 KB
/
Copy pathXPath.php
File metadata and controls
36 lines (30 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace SimpleSAML\WebServices\SecurityPolicy\Utils;
use Dom;
use SimpleSAML\WebServices\SecurityPolicy\Constants as C;
/**
* Compilation of utilities for XPath.
*
* @package simplesamlphp/xml-ws-security-policy
*/
class XPath extends \SimpleSAML\XPath\XPath
{
/*
* Get a Dom\XPath object that can be used to search for WS Security elements.
*
* @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 \Dom\XPath A Dom\XPath object ready to use in the given document, with several
* ws-related namespaces already registered.
*/
public static function getXPath(Dom\Node $node, bool $autoregister = false): Dom\XPath
{
$xp = parent::getXPath($node, $autoregister);
$xp->registerNamespace('mssp', C::NS_MSSP);
$xp->registerNamespace('sp11', C::NS_SEC_POLICY_11);
$xp->registerNamespace('sp12', C::NS_SEC_POLICY_12);
return $xp;
}
}