1 | <?php |
||
7 | class SynchronizationList implements \Countable, \IteratorAggregate |
||
8 | { |
||
9 | /** |
||
10 | * Chronologically ordered list of synchronizations (earliest to latest). |
||
11 | * |
||
12 | * @var Synchronization[] |
||
13 | */ |
||
14 | protected $synchronizations = []; |
||
15 | |||
16 | /** |
||
17 | * @param Synchronization[] $synchronizations |
||
18 | */ |
||
19 | public function __construct(array $synchronizations = []) |
||
26 | |||
27 | /** |
||
28 | * @param Synchronization $synchronization |
||
29 | * |
||
30 | * @return SynchronizationList |
||
31 | * @throws Exception |
||
32 | */ |
||
33 | public function addSynchronization(Synchronization $synchronization): SynchronizationList |
||
44 | |||
45 | /** |
||
46 | * @return Synchronization |
||
47 | */ |
||
48 | public function getLastSynchronization() |
||
52 | |||
53 | /** |
||
54 | * @param int $revision |
||
55 | * |
||
56 | * @return Synchronization |
||
57 | */ |
||
58 | public function getSynchronizationByRevision(int $revision) |
||
62 | |||
63 | /** |
||
64 | * Returns the synchronization that was the current one for the given date. |
||
65 | * |
||
66 | * @param \DateTime $time |
||
67 | * |
||
68 | * @return Synchronization |
||
69 | */ |
||
70 | public function getSynchronizationByTime(\DateTime $time) |
||
86 | |||
87 | /** |
||
88 | * Returns new synchronization list containing only those synchronizations that were performed by the given identity. |
||
89 | * |
||
90 | * @param string $identity |
||
91 | * @return SynchronizationList |
||
92 | */ |
||
93 | public function getSynchronizationsByIdentity(string $identity): SynchronizationList |
||
100 | |||
101 | /** |
||
102 | * Returns set of revisions contained in this list. |
||
103 | * |
||
104 | * @return int[] |
||
105 | */ |
||
106 | public function getRevisions(): array |
||
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | public function count(): int |
||
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | public function getIterator(): \Traversable |
||
130 | } |
||
131 |