private function revisionFor(Contract $streamContract, Identifier $streamId) { $pluckStreamRevision = __\property('streamRevision'); return $this->maximum(_\map($pluckStreamRevision, _\filter($this->belongsToStream($streamContract, $streamId), $this->records))); }
/** * @param Contract $aggregateContract * @param Identifier $aggregateId * @return Aggregate */ private function findTrackedAggregate(Contract $aggregateContract, Identifier $aggregateId) { $aggregates = _\toArray(_\filter(function (Aggregate $aggregate) use($aggregateContract, $aggregateId) { return $aggregate->isIdentifiedBy($aggregateContract, $aggregateId); }, $this->trackedAggregates)); // ugh I'm missing all kinds of FP shizzle to make this pretty. Maybe later. /** @var Aggregate $aggregate */ $aggregate = count($aggregates) ? $aggregates[0] : null; return $aggregate; }