Metadata::getAppendBeforeNode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
/**
6
 * Copyright 2015 SURFnet bv
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
20
21
namespace Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider;
22
23
use DOMDocument;
24
use LogicException;
25
use Surfnet\SamlBundle\Signing\Signable;
26
use Stringable;
27
use DOMElement;
28
use DOMNode;
29
30
class Metadata implements Signable, Stringable
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Metadata
Loading history...
31
{
32
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
33
     * @var string
34
     */
35
    public $entityId;
36
37
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
38
     * @var string
39
     */
40
    public $assertionConsumerUrl;
41
42
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
43
     * @var string
44
     */
45
    public $ssoUrl;
46
47
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
48
     * @var string
49
     */
50
    public $idpCertificateFile;
51
52
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
53
     * @var DOMDocument
54
     */
55
    public $document;
56
57
    public function getRootDomElement(): DOMElement
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getRootDomElement()
Loading history...
58
    {
59
        if (!$this->document) {
60
            throw new LogicException('Cannot get the rootElement of Metadata before the document has been generated');
61
        }
62
63
        return $this->document->documentElement;
64
    }
65
66
    public function getAppendBeforeNode(): ?DOMNode
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getAppendBeforeNode()
Loading history...
67
    {
68
        if (!$this->document) {
69
            throw new LogicException(
70
                'Cannot get the appendBeforeNode of Metadata before the document has been generated'
71
            );
72
        }
73
74
        return $this->document->documentElement->childNodes->item(0);
75
    }
76
77
    public function __toString(): string
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __toString()
Loading history...
78
    {
79
        return (string) $this->document->saveXML();
80
    }
81
}
82