Error   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getKind() 0 4 1
A getText() 0 8 2
1
<?php
2
/**
3
 * Nucleus - XMPP Library for PHP
4
 *
5
 * Copyright (C) 2016, Some rights reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Xmpp\Stream;
17
18
use Kadet\Xmpp\Utils\Accessors;
19
use Kadet\Xmpp\Xml\XmlElement;
20
21
/**
22
 * Class Error
23
 * @package Kadet\Xmpp\Stream
24
 *
25
 * @property-read string $kind Stream error defined condition
26
 * @property-read string $text Stream error text description
27
 *
28
 * @see http://xmpp.org/rfcs/rfc6120.html#streams-error-syntax
29
 */
30
class Error extends XmlElement
31
{
32
    use Accessors;
33
34
    public function getKind()
35
    {
36
        return $this->query("./xmpp:*")->with('xmpp', 'urn:ietf:params:xml:ns:xmpp-streams')->query()->current()->localName;
37
    }
38
39
    public function getText()
40
    {
41
        if ($text = $this->query(".//xmpp:text")->with('xmpp', 'urn:ietf:params:xml:ns:xmpp-streams')->query()->current()) {
42
            return $text;
43
        }
44
45
        return null;
46
    }
47
}
48