AuthXmlResponse   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 30
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getXpathTokenString() 0 3 1
A getToken() 0 3 1
A getTime() 0 3 1
A getXpathFaultString() 0 3 1
A getXpathExpireTimeString() 0 3 1
A isError() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Fns\Auth;
5
6
use SimpleXMLElement;
7
8
class AuthXmlResponse extends SimpleXMLElement
9
{
10
    private function getXpathFaultString() : string
11
    {
12
        return '//ns2:AuthResponse/ns2:Fault/ns2:Message/text()';
13
    }
14
15
    private function getXpathTokenString() : string
16
    {
17
        return  '//ns2:AuthResponse/ns2:Result/ns2:Token/text()';
18
    }
19
20
    private function getXpathExpireTimeString() : string
21
    {
22
        return  '//ns2:AuthResponse/ns2:Result/ns2:ExpireTime/text()';
23
    }
24
25
    public function isError() : bool
26
    {
27
        return !empty($this->xpath($this->getXpathFaultString()));
28
    }
29
30
    public function getToken() : string
31
    {
32
        return (string)$this->xpath($this->getXpathTokenString())[0];
33
    }
34
35
    public function getTime() : string
36
    {
37
        return (string)$this->xpath($this->getXpathExpireTimeString())[0];
38
    }
39
}
40