/** * {@inheritdoc} */ public function locate($nameOfMessage) { if (!$this->handlers->containsKey($nameOfMessage)) { throw NotFoundException::handlerFor($nameOfMessage); } return $this->handlers->get($nameOfMessage); }
/** * @return Version */ public function loadApplicationVersion() { if (!$this->store->containsKey(self::APPLICATION_VERSION_KEY)) { return Version::fromString('0.0.0'); } return $this->store->get(self::APPLICATION_VERSION_KEY); }
/** * {@inheritdoc} */ public function remove($aggregateType, IdInterface $aggregateId, Version $aggregateVersion, Version $applicationVersion) { $applicationKey = $this->getApplicationKey($applicationVersion); if (!$this->store->containsKey($applicationKey)) { return; } /** @var ArrayHashMap $applicationCollection */ $applicationCollection = $this->store->get($applicationKey); $aggregateKey = $this->getAggregateKey($aggregateType, $aggregateVersion); if (!$applicationCollection->containsKey($aggregateKey)) { return; } /** @var ArrayHashMap $aggregateCollection */ $aggregateCollection = $applicationCollection->get($aggregateKey); $aggregateCollection->removeAt($aggregateId->toNative()); }
/** * {@inheritdoc} */ public function sort(ComparatorInterface $criteria = null) { if ($criteria !== null) { $this->criteria = $criteria; } parent::sort($this->criteria); }
/** * {@inheritdoc} */ public function removeAll($streamName, Version $aggregateVersion, Version $applicationVersion) { $applicationKey = $this->getApplicationKey($applicationVersion); if (!$this->store->containsKey($applicationKey)) { throw new \RuntimeException(sprintf('The application %s not found in the event store.', $applicationKey)); } /** @var ArrayHashMap $applicationCollection */ $applicationCollection = $this->store->get($applicationKey); $streamKey = $this->getStreamKey($streamName, $aggregateVersion); $applicationCollection->removeAt($streamKey); }
/** * {@inheritdoc} */ public function removeListener($eventName, callable $listener) { if (!$this->listeners->containsKey($eventName)) { return; } /** @var SortedArrayHashMap $sortedListeners */ $sortedListeners = $this->listeners->get($eventName); /** @var ArrayList $listeners */ foreach ($sortedListeners as $priority => $listeners) { foreach ($listeners as $registered) { /** @var DelegateListener $registered */ if ($registered->equals($listener)) { $listeners->remove($registered); } } if ($listeners->count() == 0) { $sortedListeners->removeAt($priority); } } if ($sortedListeners->count() == 0) { $this->listeners->removeAt($eventName); } }
/** * @param QueryBuilder $queryBuilder1 * @param QueryBuilder $queryBuilder2 * * @return bool */ protected function hasSameOperator(QueryBuilder $queryBuilder1, QueryBuilder $queryBuilder2) { $intersection = new ArrayHashMap(\array_intersect_key($queryBuilder1->getQueryArray(), $queryBuilder2->getQueryArray())); return $intersection->keys()->findOne(Criteria::callback(function ($value) { return \strpos($value, '$') === 0; })) !== null; }
/** * @return Property[] */ public function properties() { return $this->properties->toArray(); }