Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
resultiterator.php
1
<?php
2
3
namespace
Bitrix\Main\DB
;
4
5
use
Bitrix\Main\NotSupportedException
;
6
7
class
ResultIterator
implements
\Iterator
8
{
10
private
$result;
12
private
$counter;
13
private
$currentData;
14
20
public
function
__construct
(
Result
$result)
21
{
22
$this->result = $result;
23
$this->counter = -1;
24
}
25
32
#[\ReturnTypeWillChange]
33
public
function
current
()
34
{
35
return
$this->currentData;
36
}
37
44
public
function
next
(): void
45
{
46
$this->currentData = $this->result->fetch();
47
$this->counter++;
48
}
49
56
#[\ReturnTypeWillChange]
57
public
function
key
()
58
{
59
return
$this->counter;
60
}
61
69
public
function
valid
(): bool
70
{
71
return
$this->currentData !==
false
;
72
}
73
80
public
function
rewind
(): void
81
{
82
if
($this->counter > 0)
83
{
84
throw
new
NotSupportedException
(
'Could not rewind the iterator'
);
85
}
86
87
$this->
next
();
88
}
89
}
Bitrix\Main\DB\Result
Definition
result.php:19
Bitrix\Main\DB\ResultIterator
Definition
resultiterator.php:8
Bitrix\Main\DB\ResultIterator\key
key()
Definition
resultiterator.php:57
Bitrix\Main\DB\ResultIterator\valid
valid()
Definition
resultiterator.php:69
Bitrix\Main\DB\ResultIterator\__construct
__construct(Result $result)
Definition
resultiterator.php:20
Bitrix\Main\DB\ResultIterator\next
next()
Definition
resultiterator.php:44
Bitrix\Main\DB\ResultIterator\rewind
rewind()
Definition
resultiterator.php:80
Bitrix\Main\DB\ResultIterator\current
current()
Definition
resultiterator.php:33
Bitrix\Main\NotSupportedException
Definition
exception.php:159
Bitrix\Main\DB
Definition
arrayresult.php:2
modules
main
lib
db
resultiterator.php
Создано системой
1.10.0