private function evaluateConditions(callable $conditions) { $evaluatedConditions = []; foreach ($this->store->allEvents() as $event) { $evaluatedConditions[] = $this->evaluateConditionsFor($conditions, $event); } return $evaluatedConditions; }
public function that($event, $aggregateIdentifier) { foreach ($this->listeners as $listener) { if ($listener->listensTo($event)) { $listener->on($event); } } $this->store->append($event, $aggregateIdentifier); }
/** * @param mixed|null $query * @return object * @throws \Exception */ public function project($query = null) { $projection = $this->projections->buildProjection($query); if (!is_object($projection)) { throw new \Exception('Projection must be an object.'); } $this->applyEvents($projection, $this->store->allEvents()); return $projection; }
private function appendEvents($events, $identifier) { foreach ($events as $event) { $this->store->append($event, $identifier); } }
public function appendedEvents() { return $this->store->allEvents(); }