Total Complexity | 3 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class PacketIdentifierStack |
||
13 | { |
||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | private $stack = []; |
||
18 | |||
19 | /** |
||
20 | * Adds a packet identifiable object to the stack |
||
21 | * |
||
22 | * @param WritableContentInterface $writableContent |
||
23 | * @return $this |
||
24 | */ |
||
25 | public function add(WritableContentInterface $writableContent): self |
||
26 | { |
||
27 | // TODO Replace with some way of retrieving the packet identifier |
||
28 | $this->stack[$writableContent->hasActivePacketIdentifier()] = $writableContent; |
||
29 | return $this; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Searches for a specific packetIdentifier in the stack |
||
34 | * |
||
35 | * @param int $packetIdentifier |
||
36 | * @return bool |
||
37 | */ |
||
38 | public function search(int $packetIdentifier): bool |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * TODO If this is a oneliner, maybe merge with above? Check this out later on |
||
48 | * |
||
49 | * @param int $packetIdentifier |
||
50 | * @return $this |
||
51 | */ |
||
52 | private function delete(int $packetIdentifier): self |
||
56 | } |
||
57 | } |
||
58 |