Browse code

First iteration of filterable joblist

Benjamin Roth authored on01/02/2023 22:36:09
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,102 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of alox bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license commercial
11
+ */
12
+
13
+namespace vossmedien\AloxBundle\Model;
14
+
15
+use \DateTime;
16
+
17
+class StellenModel implements \ArrayAccess, \Countable, \IteratorAggregate
18
+{
19
+    /**
20
+     * @var int
21
+     */
22
+    private int $TotalItems;
23
+
24
+    /**
25
+     * @var DateTime
26
+     */
27
+    private DateTime $LastUpdateTime;
28
+
29
+    /**
30
+     * @var array
31
+     */
32
+    private array $Items;
33
+
34
+    public function __get($name)
35
+    {
36
+        if (isset($this->{$name}) && method_exists($this,'get'.$name))
37
+        {
38
+            return $this->{'get'.$name}();
39
+        }
40
+    }
41
+
42
+
43
+    public function getItems(): array
44
+    {
45
+        return $this->Items;
46
+    }
47
+
48
+    public function getLastUpdateTime(): DateTime
49
+    {
50
+        return $this->LastUpdateTime;
51
+    }
52
+
53
+    public function getTotalItems(): int
54
+    {
55
+        return $this->TotalItems;
56
+    }
57
+
58
+    public function setItems(array $items): void
59
+    {
60
+        $this->Items = $items;
61
+    }
62
+
63
+    public function setLastUpdateTime(string $updateTime): void
64
+    {
65
+        $this->LastUpdateTime = new DateTime($updateTime);
66
+    }
67
+
68
+    public function setTotalItems(int $total): void
69
+    {
70
+        $this->TotalItems = $total;
71
+    }
72
+
73
+    public function getIterator()
74
+    {
75
+        return new \ArrayIterator($this->Items);
76
+    }
77
+
78
+    public function offsetExists($offset)
79
+    {
80
+        return isset($this->Items[$offset]);
81
+    }
82
+
83
+    public function offsetGet($offset)
84
+    {
85
+        return $this->Items[$offset];
86
+    }
87
+
88
+    public function offsetSet($offset, $value)
89
+    {
90
+        throw new \RuntimeException('This collection is immutable');
91
+    }
92
+
93
+    public function offsetUnset($offset)
94
+    {
95
+        throw new \RuntimeException('This collection is immutable');
96
+    }
97
+
98
+    public function count()
99
+    {
100
+        return \count($this->Items);
101
+    }
102
+}