Completed
Push — master ( 10de85...76baec )
by Kacper
03:21
created

Stream::getXmlns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 1
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
19
use Kadet\Xmpp\Xml\XmlElement;
20
21
/**
22
 * Class describing root element of stream.
23
 * It doesn't store any references to it's children, only children can refer that class, so they can be garbage
24
 * collected when needed. It's used mainly for storing default namespace for stanzas.
25
 *
26
 * @package Kadet\Xmpp\Stream
27
 *
28
 * @property string $xmlns Default namespace for stanzas
29
 *
30
 * @internal
31
 */
32
class Stream extends XmlElement
33
{
34
    /**
35
     * Stream constructor
36
     *
37
     * @param array  $options {
38
     *     @var mixed    $content    Content of element
39
     *     @var string   $xmlns      Namespace of stream elements
40
     *     @var array    $attributes Stream attributes
41
     * }
42
     */
43
    public function __construct(array $options)
44
    {
45
        parent::__construct('stream:stream', 'http://etherx.jabber.org/streams', $options);
46
    }
47
48
    //region Default Namespace
49
    public function setXmlns($uri)
50
    {
51
        $this->setNamespace($uri, null);
52
    }
53
54
    public function getXmlns()
55
    {
56
        return $this->getNamespace(null);
57
    }
58
    //endregion
59
60
    public function setInnerXml($value)
61
    {
62
        return false;
63
    }
64
65
    public function setContent($value)
66
    {
67
        return false;
68
    }
69
70
    public function appendChild($element)
71
    {
72
        if ($element instanceof XmlElement) {
73
            $element->parent = $this;
74
        }
75
76
        return null;
77
    }
78
}
79