Issues (9)

src/Builder/Node.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Inspirum\XML\Builder;
6
7
use DOMDocument;
8
use DOMNode;
9
use Inspirum\Arrayable\Model;
10
use Inspirum\XML\Formatter\Config;
11
12
/**
13
 * @extends \Inspirum\Arrayable\Model<int|string,mixed>
14
 */
15
interface Node extends Model
16
{
17
    /**
18
     * Add element to XML node
19
     *
20
     * @param array<string,mixed> $attributes
21
     *
22
     * @throws \DOMException
23
     */
24
    public function addElement(string $name, array $attributes = [], bool $withNamespaces = true): Node;
25
26
    /**
27
     * Add text element
28
     *
29
     * @param array<string,mixed> $attributes
30
     *
31
     * @throws \DOMException
32
     */
33
    public function addTextElement(string $name, mixed $value, array $attributes = [], bool $forcedEscape = false, bool $withNamespaces = true): Node;
34
35
    /**
36
     * Add element from \DOMNode
37
     *
38
     * @throws \DOMException
39
     */
40
    public function addElementFromNode(DOMNode $node, bool $forcedEscape = false, bool $withNamespaces = true): Node;
41
42
    /**
43
     * Append node to parent node.
44
     */
45
    public function append(Node $element): void;
46
47
    /**
48
     * Create new (unconnected) element
49
     *
50
     * @param array<string,mixed> $attributes
51
     *
52
     * @throws \DOMException
53
     */
54
    public function createElement(string $name, array $attributes = [], bool $withNamespaces = true): Node;
55
56
    /**
57
     * Create new (unconnected) text element
58
     *
59
     * @param array<string,mixed> $attributes
60
     *
61
     * @throws \DOMException
62
     */
63
    public function createTextElement(string $name, mixed $value, array $attributes = [], bool $forcedEscape = false, bool $withNamespaces = true): Node;
64
65
    /**
66
     * Create new (unconnected) element from \DOMNode
67
     *
68
     * @throws \DOMException
69
     */
70
    public function createElementFromNode(DOMNode $node, bool $forcedEscape = false, bool $withNamespaces = true): Node;
71
72
    /**
73
     * Add XML data
74
     */
75
    public function addXMLData(string $content): ?Node;
76
77
    /**
78
     * Get node text content
79
     */
80
    public function getTextContent(): ?string;
81
82
    /**
83
     * Get node attributes
84
     *
85
     * @return ($autoCast is true ? array<string,mixed> : array<string,string>)
86
     */
87
    public function getAttributes(bool $autoCast = false): array;
88
89
    /**
90
     * @return list<\Inspirum\XML\Builder\Node>|null
0 ignored issues
show
The type Inspirum\XML\Builder\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
91
     */
92
    public function xpath(string $expression): ?array;
93
94
    /**
95
     * Get connected \DOMDocument
96
     */
97
    public function getDocument(): DOMDocument;
98
99
    /**
100
     * Get connected \DOMNode
101
     */
102
    public function getNode(): ?DOMNode;
103
104
    /**
105
     * Return valid XML string.
106
     *
107
     * @throws \DOMException
108
     */
109
    public function toString(bool $formatOutput = false): string;
110
111
    /**
112
     * Convert to array
113
     *
114
     * @return array<int|string,mixed>
115
     */
116
    public function toArray(?Config $config = null): array;
117
}
118