@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | public function handle(EventInterface $event) |
| 28 | 28 | { |
| 29 | 29 | $method = $this->getHandleMethod($event); |
| 30 | - if (! method_exists($this, $method)) { |
|
| 31 | - throw new ProjectorHandleMethodDoesNotExistsException(get_class($this) . ' does not implement ' . $method . ' method.'); |
|
| 30 | + if (!method_exists($this, $method)) { |
|
| 31 | + throw new ProjectorHandleMethodDoesNotExistsException(get_class($this).' does not implement '.$method.' method.'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $this->$method($event); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | private function getHandleMethod($event) |
| 42 | 42 | { |
| 43 | - return 'apply' . $this->getLastClassParts($event); |
|
| 43 | + return 'apply'.$this->getLastClassParts($event); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | public function rollback(EventInterface $event) |
| 61 | 61 | { |
| 62 | 62 | $method = $this->getRollbackMethod($event); |
| 63 | - if (! method_exists($this, $method)) { |
|
| 64 | - throw new ProjectorRollbackMethodDoesNotExistsException(get_class($this) . ' does not implement ' . $method . ' method.'); |
|
| 63 | + if (!method_exists($this, $method)) { |
|
| 64 | + throw new ProjectorRollbackMethodDoesNotExistsException(get_class($this).' does not implement '.$method.' method.'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $this->$method($event); |
@@ -73,6 +73,6 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function getRollbackMethod($event) |
| 75 | 75 | { |
| 76 | - return 'rollback' . $this->getLastClassParts($event); |
|
| 76 | + return 'rollback'.$this->getLastClassParts($event); |
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function project(EventInterface $event) |
| 55 | 55 | { |
| 56 | 56 | if (!isset($this->projectors[get_class($event)])) { |
| 57 | - throw new ProjectorDoesNotExistsException('No Projector found for event ' . get_class($event) . '.'); |
|
| 57 | + throw new ProjectorDoesNotExistsException('No Projector found for event '.get_class($event).'.'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $this->projectors[get_class($event)]->handle($event); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function rollback(EventInterface $event) |
| 83 | 83 | { |
| 84 | 84 | if (!isset($this->projectors[get_class($event)])) { |
| 85 | - throw new ProjectorDoesNotExistsException('No Projector found for event ' . get_class($event) . '.'); |
|
| 85 | + throw new ProjectorDoesNotExistsException('No Projector found for event '.get_class($event).'.'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $this->projectors[get_class($event)]->rollback($event); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $eventsCollection = new EventCollectionObjectRepresentation( |
| 32 | 32 | (int) $page, |
| 33 | 33 | (int) $maxPerPage, |
| 34 | - (int) $numberOfPages = ceil($eventsCount/$maxPerPage), |
|
| 34 | + (int) $numberOfPages = ceil($eventsCount / $maxPerPage), |
|
| 35 | 35 | (int) $eventsCount, |
| 36 | 36 | $this->calculateLinks($page, $numberOfPages) |
| 37 | 37 | ); |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | protected function convertEventsDataToArray($events) |
| 55 | 55 | { |
| 56 | 56 | return array_map( |
| 57 | - function (EventInterface $event) { |
|
| 57 | + function(EventInterface $event) { |
|
| 58 | 58 | return [ |
| 59 | 59 | 'uuid' => $event->uuid(), |
| 60 | 60 | 'version' => $event->version(), |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | '_meta' => [ |
| 36 | 36 | 'page' => $page, |
| 37 | 37 | 'records_per_page' => $maxPerPage, |
| 38 | - 'total_pages' => $numberOfPages = ceil($eventsCount/$maxPerPage), |
|
| 38 | + 'total_pages' => $numberOfPages = ceil($eventsCount / $maxPerPage), |
|
| 39 | 39 | 'total_count' => $eventsCount |
| 40 | 40 | ], |
| 41 | 41 | '_links' => [ |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public function byUuid(AggregateUuid $uuid, $returnType = self::RETURN_AS_ARRAY) |
| 48 | 48 | { |
| 49 | - $events = array_map(function($event){ |
|
| 49 | + $events = array_map(function($event) { |
|
| 50 | 50 | return unserialize($event); |
| 51 | 51 | }, $this->client->hgetall((string) $uuid)); |
| 52 | 52 | |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | public function connect() |
| 88 | 88 | { |
| 89 | 89 | $connectionString = 'mongodb://'; |
| 90 | - $connectionString .= (isset($this->config['username']) && isset($this->config['password'])) ? $this->config['username'].':'.$this->config['password'].'@' : ''; |
|
| 90 | + $connectionString .= (isset($this->config['username']) && isset($this->config['password'])) ? $this->config['username'].':'.$this->config['password'].'@' : ''; |
|
| 91 | 91 | $connectionString .= $this->config['host'].':'.$this->config['port']; |
| 92 | 92 | |
| 93 | 93 | $database = (isset($this->config['database'])) ? $this->config['database'] : 'eventstore'; |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | */ |
| 80 | 80 | public function query(array $stream, array $filters = []) |
| 81 | 81 | { |
| 82 | - $qb = QueryBuilder::create((array)$stream); |
|
| 82 | + $qb = QueryBuilder::create((array) $stream); |
|
| 83 | 83 | |
| 84 | 84 | foreach ($filters as $key => $value) { |
| 85 | 85 | $qb->addCriterion($key, $value); |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | public function setReturnType($returnType = EventStoreRepositoryInterface::RETURN_AS_ARRAY) |
| 129 | 129 | { |
| 130 | 130 | if (false === $this->checkReturnType($returnType)) { |
| 131 | - throw new NotSupportedReturnTypeException($returnType . ' is not a valid returnType value.'); |
|
| 131 | + throw new NotSupportedReturnTypeException($returnType.' is not a valid returnType value.'); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $this->returnType = $returnType; |