| @@ -30,7 +30,7 @@ | ||
| 30 | 30 |      { | 
| 31 | 31 |          if (null !== $this->aggregateRoot && $aggregateRoot !== $this->aggregateRoot) { | 
| 32 | 32 | throw new InvalidArgumentException(sprintf( | 
| 33 | - 'Aggregate root "%s" already registered on "%s".', | |
| 33 | + 'Aggregate root "%s" already registered on "%s".', | |
| 34 | 34 | get_class($aggregateRoot), | 
| 35 | 35 | get_called_class() | 
| 36 | 36 | )); | 
| @@ -108,7 +108,7 @@ | ||
| 108 | 108 | */ | 
| 109 | 109 | protected function getClosureHandler($handler, $class) | 
| 110 | 110 |      { | 
| 111 | -        return function (MessageInterface $message) use ($handler, $class) { | |
| 111 | +        return function(MessageInterface $message) use ($handler, $class) { | |
| 112 | 112 | $class = ltrim(get_class($message), '\\'); | 
| 113 | 113 |              if (!isset($this->messages[$class])) { | 
| 114 | 114 |                  throw new LogicException(sprintf('Message "%s" does not have handler.', $class)); | 
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | */ | 
| 24 | 24 | public function __construct(\PDOException $e) | 
| 25 | 25 |      { | 
| 26 | -        if(strstr($e->getMessage(), 'SQLSTATE[')) { | |
| 26 | +        if (strstr($e->getMessage(), 'SQLSTATE[')) { | |
| 27 | 27 |              preg_match('/SQLSTATE\[(\w+)\] \[(\w+)\] (.*)/', $e->getMessage(), $matches); | 
| 28 | 28 |              if (count($matches)) { | 
| 29 | 29 | $this->code = ($matches[1] == 'HT000' ? $matches[2] : $matches[1]); | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | public function sum($fields) | 
| 68 | 68 |      { | 
| 69 | 69 | $total = 0; | 
| 70 | -        $this->walk($fields, function () use (&$total) { | |
| 70 | +        $this->walk($fields, function() use (&$total) { | |
| 71 | 71 | $total += array_sum(func_get_args()); | 
| 72 | 72 | }); | 
| 73 | 73 | |
| @@ -96,7 +96,7 @@ discard block | ||
| 96 | 96 | public function max($fields) | 
| 97 | 97 |      { | 
| 98 | 98 | $max = 0; | 
| 99 | -        $this->walk($fields, function () use (&$max) { | |
| 99 | +        $this->walk($fields, function() use (&$max) { | |
| 100 | 100 | $cur = max(func_get_args()); | 
| 101 | 101 |              if ($cur > $max) { | 
| 102 | 102 | $max = $cur; | 
| @@ -116,7 +116,7 @@ discard block | ||
| 116 | 116 | public function min($fields) | 
| 117 | 117 |      { | 
| 118 | 118 | $min = null; | 
| 119 | -        $this->walk($fields, function () use (&$min) { | |
| 119 | +        $this->walk($fields, function() use (&$min) { | |
| 120 | 120 | $cur = min(func_get_args()); | 
| 121 | 121 |              if (null === $min) { | 
| 122 | 122 | $min = $cur; | 
| @@ -145,7 +145,7 @@ discard block | ||
| 145 | 145 | |
| 146 | 146 | $num = 0; | 
| 147 | 147 | |
| 148 | -        $this->walk($fields, function () use (&$num) { | |
| 148 | +        $this->walk($fields, function() use (&$num) { | |
| 149 | 149 | $num += count(array_filter(func_get_args())); | 
| 150 | 150 | }); | 
| 151 | 151 | |
| @@ -213,7 +213,7 @@ discard block | ||
| 213 | 213 | $this->viewModel->setForceSingle(); | 
| 214 | 214 |          $fields = explode(',', trim($fields)); | 
| 215 | 215 | |
| 216 | -        return array_walk($this->data, function (array $record) use ($fields, $callback) { | |
| 216 | +        return array_walk($this->data, function(array $record) use ($fields, $callback) { | |
| 217 | 217 | $args = $this->getArguments($fields, $record); | 
| 218 | 218 | |
| 219 | 219 | return call_user_func_array($callback, $args); | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 |          } elseif (is_array($record)) { | 
| 108 | 108 | $built = $this->serialize($record, $record); | 
| 109 | 109 |          } else { | 
| 110 | -            $built = array_map(function ($readModel) use ($record) { | |
| 110 | +            $built = array_map(function($readModel) use ($record) { | |
| 111 | 111 |                  if ($readModel instanceof ReadModelInterface) { | 
| 112 | 112 | $readModel = $readModel->serialize(); | 
| 113 | 113 | } | 
| @@ -296,7 +296,7 @@ discard block | ||
| 296 | 296 | */ | 
| 297 | 297 | private function computeViewModelValue($results, array $record, $field) | 
| 298 | 298 |      { | 
| 299 | - $method = $this->prefixMethod . ucfirst($field); | |
| 299 | + $method = $this->prefixMethod.ucfirst($field); | |
| 300 | 300 |          if (method_exists($this, $method)) { | 
| 301 | 301 | return call_user_func_array( | 
| 302 | 302 | array($this, $method), | 
| @@ -376,7 +376,7 @@ discard block | ||
| 376 | 376 |      { | 
| 377 | 377 |          if (!$data instanceof ReadModelInterface && !$data instanceof Collection && !is_array($data)) { | 
| 378 | 378 | throw new InvalidArgumentException(sprintf( | 
| 379 | - 'Acceptable data type is \Borobudur\Cqrs\ReadModel\ReadModelInterface, ' . | |
| 379 | + 'Acceptable data type is \Borobudur\Cqrs\ReadModel\ReadModelInterface, '. | |
| 380 | 380 | '\Borobudur\Cqrs\Collection, Borobudur\Cqrs\ViewModel\ViewModel or nested array, but got "%s".', | 
| 381 | 381 | gettype($data) | 
| 382 | 382 | )); | 
| @@ -100,12 +100,12 @@ discard block | ||
| 100 | 100 | $fields = func_get_args(); | 
| 101 | 101 | $elements = array(); | 
| 102 | 102 |          if ($fields || (isset($this->elements[0]) && is_array($this->elements[0]))) { | 
| 103 | -            $this->each(function ($element) use (&$elements, $fields) { | |
| 103 | +            $this->each(function($element) use (&$elements, $fields) { | |
| 104 | 104 |                  if (is_object($element)) { | 
| 105 | 105 |                      if ($fields) { | 
| 106 | 106 |                          foreach ($fields as $field) { | 
| 107 | - $methodGet = 'get' . ucfirst($field); | |
| 108 | - $methodIs = 'is' . ucfirst($field); | |
| 107 | + $methodGet = 'get'.ucfirst($field); | |
| 108 | + $methodIs = 'is'.ucfirst($field); | |
| 109 | 109 | |
| 110 | 110 |                              if (method_exists($element, $methodGet)) { | 
| 111 | 111 |                                  $elements[] = $element->{$methodGet}(); | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 | $elements = parent::toArray($resortIndex); | 
| 148 | 148 | |
| 149 | 149 |          if (null !== $this->classMapper) { | 
| 150 | -            return array_map(function (SerializableInterface $element) { | |
| 150 | +            return array_map(function(SerializableInterface $element) { | |
| 151 | 151 | return $element->serialize(); | 
| 152 | 152 | }, (array) $elements); | 
| 153 | 153 | } | 
| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | private function assertValidClassMapper($classMapper) | 
| 166 | 166 |      { | 
| 167 | 167 |          if (null !== $classMapper) { | 
| 168 | - $classMapper = '\\' . ltrim($classMapper, '\\'); | |
| 168 | + $classMapper = '\\'.ltrim($classMapper, '\\'); | |
| 169 | 169 |              if (!class_exists($classMapper)) { | 
| 170 | 170 |                  throw new InvalidArgumentException(sprintf('Class "%s" is undefined.', $classMapper)); | 
| 171 | 171 | } | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | * @param ParserInterface $parser | 
| 80 | 80 | * @param string $quote | 
| 81 | 81 | */ | 
| 82 | - public function __construct(Pdo &$conn, $table, $class, $parser, $quote) | |
| 82 | + public function __construct(Pdo & $conn, $table, $class, $parser, $quote) | |
| 83 | 83 |      { | 
| 84 | 84 | $this->conn = $conn; | 
| 85 | 85 | $this->table = $table; | 
| @@ -207,16 +207,16 @@ discard block | ||
| 207 | 207 | protected function computeQuery($fields = '*') | 
| 208 | 208 |      { | 
| 209 | 209 | $parts = array( | 
| 210 | - 'SELECT ' . $fields, | |
| 211 | - 'FROM ' . $this->quote($this->table), | |
| 210 | + 'SELECT '.$fields, | |
| 211 | + 'FROM '.$this->quote($this->table), | |
| 212 | 212 | ); | 
| 213 | 213 | |
| 214 | 214 |          if (!empty($this->conditions)) { | 
| 215 | - $parts[] = 'WHERE ' . $this->normalizeConditions(); | |
| 215 | + $parts[] = 'WHERE '.$this->normalizeConditions(); | |
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | 218 |          if (!empty($this->sorts)) { | 
| 219 | - $parts[] = 'ORDER BY ' . $this->normalizeSorts(); | |
| 219 | + $parts[] = 'ORDER BY '.$this->normalizeSorts(); | |
| 220 | 220 | } | 
| 221 | 221 | |
| 222 | 222 |          if (null !== $this->limit) { | 
| @@ -233,9 +233,9 @@ discard block | ||
| 233 | 233 | */ | 
| 234 | 234 | protected function normalizeConditions() | 
| 235 | 235 |      { | 
| 236 | - $joiner = ' ' . CompositeExpressionInterface::LOGICAL_AND . ' '; | |
| 236 | + $joiner = ' '.CompositeExpressionInterface::LOGICAL_AND.' '; | |
| 237 | 237 | |
| 238 | -        return implode($joiner, array_map(function ($item) { | |
| 238 | +        return implode($joiner, array_map(function($item) { | |
| 239 | 239 | return (string) $item; | 
| 240 | 240 | }, $this->conditions)); | 
| 241 | 241 | } | 
| @@ -249,7 +249,7 @@ discard block | ||
| 249 | 249 |      { | 
| 250 | 250 | $sorts = array(); | 
| 251 | 251 |          foreach ($this->sorts as $field => $direction) { | 
| 252 | - $sorts[] = $this->quote($field) . ' ' . $direction; | |
| 252 | + $sorts[] = $this->quote($field).' '.$direction; | |
| 253 | 253 | } | 
| 254 | 254 | |
| 255 | 255 |          return implode(', ', $sorts); | 
| @@ -264,6 +264,6 @@ discard block | ||
| 264 | 264 | */ | 
| 265 | 265 | protected function quote($field) | 
| 266 | 266 |      { | 
| 267 | - return $this->quote . $field . $this->quote; | |
| 267 | + return $this->quote.$field.$this->quote; | |
| 268 | 268 | } | 
| 269 | 269 | } | 
| @@ -81,7 +81,7 @@ | ||
| 81 | 81 | */ | 
| 82 | 82 | public function process() | 
| 83 | 83 |      { | 
| 84 | -        return sprintf('(%s)', implode(' ' . $this->logic . ' ', $this->parts)); | |
| 84 | +        return sprintf('(%s)', implode(' '.$this->logic.' ', $this->parts)); | |
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 | /** | 
| @@ -167,7 +167,7 @@ | ||
| 167 | 167 | */ | 
| 168 | 168 | protected function createParser() | 
| 169 | 169 |      { | 
| 170 | -        switch(strtolower($this->engine)) { | |
| 170 | +        switch (strtolower($this->engine)) { | |
| 171 | 171 | case 'pgsql': | 
| 172 | 172 | return new PostgresParser(); | 
| 173 | 173 | } |