This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
EventCollection.php
119 lines (104 loc) · 2.98 KB
/
EventCollection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
declare(strict_types=1);
namespace Eloquent\Phony\Event;
use Countable;
use Eloquent\Phony\Call\Call;
use Eloquent\Phony\Call\Exception\UndefinedCallException;
use Eloquent\Phony\Event\Exception\UndefinedEventException;
use IteratorAggregate;
/**
* The interface implemented by event collections.
*
* @extends IteratorAggregate<int,Event>
*/
interface EventCollection extends IteratorAggregate, Countable
{
/**
* Returns true if this collection contains any events.
*
* @return bool True if this collection contains any events.
*/
public function hasEvents(): bool;
/**
* Returns true if this collection contains any calls.
*
* @return bool True if this collection contains any calls.
*/
public function hasCalls(): bool;
/**
* Get the number of events.
*
* @return int The event count.
*/
public function eventCount(): int;
/**
* Get the number of calls.
*
* @return int The call count.
*/
public function callCount(): int;
/**
* Get all events as an array.
*
* @return array<Event> The events.
*/
public function allEvents(): array;
/**
* Get all calls as an array.
*
* @return array<Call> The calls.
*/
public function allCalls(): array;
/**
* Get the first event.
*
* @return Event The event.
* @throws UndefinedEventException If there are no events.
*/
public function firstEvent(): Event;
/**
* Get the last event.
*
* @return Event The event.
* @throws UndefinedEventException If there are no events.
*/
public function lastEvent(): Event;
/**
* Get an event by index.
*
* Negative indices are offset from the end of the list. That is, `-1`
* indicates the last element, and `-2` indicates the second last element.
*
* @param int $index The index.
*
* @return Event The event.
* @throws UndefinedEventException If the requested event is undefined, or there are no events.
*/
public function eventAt(int $index = 0): Event;
/**
* Get the first call.
*
* @return Call The call.
* @throws UndefinedCallException If there are no calls.
*/
public function firstCall(): Call;
/**
* Get the last call.
*
* @return Call The call.
* @throws UndefinedCallException If there are no calls.
*/
public function lastCall(): Call;
/**
* Get a call by index.
*
* Negative indices are offset from the end of the list. That is, `-1`
* indicates the last element, and `-2` indicates the second last element.
*
* @param int $index The index.
*
* @return Call The call.
* @throws UndefinedCallException If the requested call is undefined, or there are no calls.
*/
public function callAt(int $index = 0): Call;
}