Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
nodelist.php
1
<?php
2
namespace
Bitrix\Main\Web\DOM
;
3
4
/*
5
class NodeList extends \Bitrix\Main\Type\Dictionary implements \Traversable
6
{
7
public function item($index)
8
{
9
return $this->offsetGet($index);
10
}
11
12
public function haveItem(Node $item)
13
{
14
for($i = 0; $i < $this->count(); $i++)
15
{
16
if($item->isEqual($this->item($i)))
17
{
18
return true;
19
}
20
}
21
22
return false;
23
}
24
25
public function removeItem(Node $item)
26
{
27
for($i = 0; $i < $this->count(); $i++)
28
{
29
if($item === $this->item($i))
30
{
31
$this->offsetUnset($i);
32
break;
33
}
34
}
35
}
36
}
37
*/
38
39
class
NodeList
implements
\Iterator {
40
protected
$length
= 0;
41
protected
$position
= 0;
42
protected
$values
= array();
43
44
public
function
__construct
(array
$values
=
null
)
45
{
46
if
(
$values
===
null
)
47
{
48
$this->position = 0;
49
$this->
set
(
$values
);
50
}
51
}
52
53
public
function
getLength
()
54
{
55
return
$this->length
;
56
}
57
58
/*
59
* @return Node|null
60
*/
61
public
function
item
($index)
62
{
63
if
($this->
valid
($index))
64
{
65
return
$this->values[$index];
66
}
67
68
return
null
;
69
}
70
71
public
function
set
(array
$values
)
72
{
73
$this->values = array_values(
$values
);
74
$this->length = count($this->values);
75
}
76
77
public
function
get
()
78
{
79
return
$this->values
;
80
}
81
82
public
function
rewind
()
83
{
84
$this->position = 0;
85
}
86
87
public
function
current
()
88
{
89
return
$this->values[
$this->position
];
90
}
91
92
public
function
key
()
93
{
94
return
$this->position
;
95
}
96
97
public
function
next
()
98
{
99
++
$this->position
;
100
}
101
102
public
function
valid
($index =
null
)
103
{
104
if
($index ===
null
)
105
{
106
$index =
$this->position
;
107
}
108
109
return
isset($this->values[$index]);
110
}
111
}
Bitrix\Main\Web\DOM\NodeList
Definition
nodelist.php:39
Bitrix\Main\Web\DOM\NodeList\__construct
__construct(array $values=null)
Definition
nodelist.php:44
Bitrix\Main\Web\DOM\NodeList\$position
$position
Definition
nodelist.php:41
Bitrix\Main\Web\DOM\NodeList\key
key()
Definition
nodelist.php:92
Bitrix\Main\Web\DOM\NodeList\getLength
getLength()
Definition
nodelist.php:53
Bitrix\Main\Web\DOM\NodeList\valid
valid($index=null)
Definition
nodelist.php:102
Bitrix\Main\Web\DOM\NodeList\next
next()
Definition
nodelist.php:97
Bitrix\Main\Web\DOM\NodeList\$length
$length
Definition
nodelist.php:40
Bitrix\Main\Web\DOM\NodeList\rewind
rewind()
Definition
nodelist.php:82
Bitrix\Main\Web\DOM\NodeList\item
item($index)
Definition
nodelist.php:61
Bitrix\Main\Web\DOM\NodeList\current
current()
Definition
nodelist.php:87
Bitrix\Main\Web\DOM\NodeList\$values
$values
Definition
nodelist.php:42
Bitrix\Main\Web\DOM
Definition
attr.php:2
modules
main
lib
web
dom
nodelist.php
Создано системой
1.10.0