XPath   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 16
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getXPath() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\CAS\Utils;
6
7
use DOMNode;
8
use DOMXPath;
9
use SimpleSAML\CAS\Constants as C;
10
11
/**
12
 * Compilation of utilities for XPath.
13
 *
14
 * @package simplesamlphp/cas
15
 */
16
class XPath extends \SimpleSAML\XML\Utils\XPath
17
{
18
    /**
19
     * Get a DOMXPath object that can be used to search for CAS elements.
20
     *
21
     * @param \DOMNode $node The document to associate to the DOMXPath object.
22
     *
23
     * @return \DOMXPath A DOMXPath object ready to use in the given document, with several
24
     *   cas-related namespaces already registered.
25
     */
26
    public static function getXPath(DOMNode $node): DOMXPath
27
    {
28
        $xp = parent::getXPath($node);
29
        $xp->registerNamespace('cas', C::NS_CAS);
30
31
        return $xp;
32
    }
33
}
34