1 | <?php |
||
9 | class Cursor implements \Iterator |
||
10 | { |
||
11 | /** |
||
12 | * @var ConnectionInterface |
||
13 | */ |
||
14 | private $connection; |
||
15 | |||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | private $token; |
||
20 | |||
21 | /** |
||
22 | * @param ConnectionInterface $connection |
||
23 | * @param int $token |
||
24 | * @param ResponseInterface $response |
||
25 | */ |
||
26 | public function __construct(ConnectionInterface $connection, int $token, ResponseInterface $response) |
||
33 | |||
34 | private function setBatch($response) |
||
44 | |||
45 | /** |
||
46 | * @inheritdoc |
||
47 | */ |
||
48 | public function current() |
||
52 | |||
53 | /** |
||
54 | * @inheritdoc |
||
55 | */ |
||
56 | public function next() |
||
60 | |||
61 | /** |
||
62 | * @inheritdoc |
||
63 | */ |
||
64 | public function key() |
||
68 | |||
69 | /** |
||
70 | * @inheritdoc |
||
71 | */ |
||
72 | public function valid() |
||
76 | |||
77 | /** |
||
78 | * @inheritdoc |
||
79 | */ |
||
80 | public function rewind() |
||
84 | } |
||
85 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: