ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PropertyList.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=0);
20 
22 
24 
26 {
27  protected int $index;
31  protected array $values;
35  protected array $keys;
36 
40  public function __construct(
41  array $properties
42  ) {
43  $this->index = 0;
44  $this->values = array_values($properties);
45  $this->keys = array_keys($properties);
46  }
47 
48  public function next(): void
49  {
50  $this->index++;
51  }
52 
53  public function rewind(): void
54  {
55  $this->index = 0;
56  }
57 
58  public function valid(): bool
59  {
60  return isset($this->keys[$this->index]);
61  }
62 
63  public function key(): string
64  {
65  return $this->keys[$this->index];
66  }
67 
68  public function current(): string
69  {
70  return $this->values[$this->index];
71  }
72 
73  public function count(): int
74  {
75  return count($this->keys);
76  }
77 }