@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $arguments[0] = $this->prepare($arguments[0]); |
| 130 | 130 | |
| 131 | 131 | //Routing where |
| 132 | - call_user_func_array([$this->query, 'and' . ucfirst($this->target)], $arguments); |
|
| 132 | + call_user_func_array([$this->query, 'and'.ucfirst($this->target)], $arguments); |
|
| 133 | 133 | |
| 134 | 134 | return $this; |
| 135 | 135 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $arguments[0] = $this->prepare($arguments[0]); |
| 160 | 160 | |
| 161 | 161 | //Routing where |
| 162 | - call_user_func_array([$this->query, 'or' . ucfirst($this->target)], $arguments); |
|
| 162 | + call_user_func_array([$this->query, 'or'.ucfirst($this->target)], $arguments); |
|
| 163 | 163 | |
| 164 | 164 | return $this; |
| 165 | 165 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $aggregationType = isset($type[Document::ONE]) ? Document::ONE : Document::MANY; |
| 176 | 176 | |
| 177 | 177 | $result[$field] = new AggregationDefinition( |
| 178 | - $aggregationType, //Aggregation type |
|
| 178 | + $aggregationType, //Aggregation type |
|
| 179 | 179 | $type[$aggregationType], //Class name |
| 180 | 180 | array_pop($type) //Query template |
| 181 | 181 | ); |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | if ( |
| 363 | 363 | is_array($type) |
| 364 | 364 | && is_scalar($type[0]) |
| 365 | - && $filter = $this->mutators->getMutators('array::' . $type[0]) |
|
| 365 | + && $filter = $this->mutators->getMutators('array::'.$type[0]) |
|
| 366 | 366 | ) { |
| 367 | 367 | //Mutator associated to array with specified type |
| 368 | 368 | $resolved += $filter; |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | //Removing values from array (non strict) |
| 132 | - $this->values = array_filter($this->values, function ($item) use ($value) { |
|
| 132 | + $this->values = array_filter($this->values, function($item) use ($value) { |
|
| 133 | 133 | return $item != $value; |
| 134 | 134 | }); |
| 135 | 135 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | break; |
| 101 | 101 | default: |
| 102 | 102 | throw new EntityException( |
| 103 | - "Undefined field format '" . static::FIELD_FORMAT . "'" |
|
| 103 | + "Undefined field format '".static::FIELD_FORMAT."'" |
|
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | ): AccessorInterface { |
| 520 | 520 | if (!is_string($accessor) || !class_exists($accessor)) { |
| 521 | 521 | throw new EntityException( |
| 522 | - "Unable to create accessor for field {$field} in " . static::class |
|
| 522 | + "Unable to create accessor for field {$field} in ".static::class |
|
| 523 | 523 | ); |
| 524 | 524 | } |
| 525 | 525 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | if (!$this->hasField($name)) { |
| 180 | 180 | //We are only allowing to modify existed fields, this is strict schema |
| 181 | - throw new FieldException("Undefined field '{$name}' in '" . static::class . "'"); |
|
| 181 | + throw new FieldException("Undefined field '{$name}' in '".static::class."'"); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | //Original field value |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | if ($value instanceof CompositableInterface) { |
| 295 | 295 | $atomics = array_merge_recursive( |
| 296 | 296 | $atomics, |
| 297 | - $value->buildAtomics((!empty($container) ? $container . '.' : '') . $field) |
|
| 297 | + $value->buildAtomics((!empty($container) ? $container.'.' : '').$field) |
|
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | 300 | continue; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | if (array_key_exists($field, $this->updates)) { |
| 311 | 311 | //Generating set operation for changed field |
| 312 | - $atomics['$set'][(!empty($container) ? $container . '.' : '') . $field] = $value; |
|
| 312 | + $atomics['$set'][(!empty($container) ? $container.'.' : '').$field] = $value; |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | { |
| 357 | 357 | $public = parent::publicFields(); |
| 358 | 358 | |
| 359 | - array_walk_recursive($public, function (&$value) { |
|
| 359 | + array_walk_recursive($public, function(&$value) { |
|
| 360 | 360 | if ($value instanceof ObjectID) { |
| 361 | 361 | $value = (string)$value; |
| 362 | 362 | } |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | */ |
| 151 | 151 | public function query(array $query = []) |
| 152 | 152 | { |
| 153 | - array_walk_recursive($query, function (&$value) { |
|
| 153 | + array_walk_recursive($query, function(&$value) { |
|
| 154 | 154 | if ($value instanceof \DateTime) { |
| 155 | 155 | //MongoDate is always UTC, which is good :) |
| 156 | 156 | $value = new \MongoDate($value->getTimestamp()); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | * @param bool $changedEntities Reference, will be set to true if any of entities changed |
| 260 | 260 | * internally. |
| 261 | 261 | */ |
| 262 | - public function hasUpdates(bool &$changedEntities = null): bool |
|
| 262 | + public function hasUpdates(bool & $changedEntities = null): bool |
|
| 263 | 263 | { |
| 264 | 264 | foreach ($this->entities as $entity) { |
| 265 | 265 | if ($entity->hasUpdates()) { |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | $atomics = array_merge( |
| 328 | 328 | $atomics, |
| 329 | - $document->buildAtomics((!empty($container) ? $container . '.' : '') . $offset) |
|
| 329 | + $document->buildAtomics((!empty($container) ? $container.'.' : '').$offset) |
|
| 330 | 330 | ); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @param string|\MongoId $id Primary key value. |
| 96 | 96 | * |
| 97 | - * @return CompositableInterface|Document|null |
|
| 97 | + * @return CompositableInterface|null |
|
| 98 | 98 | */ |
| 99 | 99 | public function findByPK($id) |
| 100 | 100 | { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param array $query Fields and conditions to query by. |
| 108 | 108 | * @param array $sortBy Always specify sort by to ensure that results are stable. |
| 109 | 109 | * |
| 110 | - * @return CompositableInterface|Document|null |
|
| 110 | + * @return CompositableInterface|null |
|
| 111 | 111 | */ |
| 112 | 112 | public function findOne(array $query = [], array $sortBy = []) |
| 113 | 113 | { |
@@ -93,13 +93,15 @@ |
||
| 93 | 93 | //Via global scope |
| 94 | 94 | $container = self::staticContainer(); |
| 95 | 95 | |
| 96 | - if (empty($container)) //Via global scope |
|
| 96 | + if (empty($container)) { |
|
| 97 | + //Via global scope |
|
| 97 | 98 | { |
| 98 | 99 | throw new ScopeException(sprintf( |
| 99 | 100 | "Unable to get '%s' source, no container scope is available", |
| 100 | 101 | static::class |
| 101 | 102 | )); |
| 102 | 103 | } |
| 104 | + } |
|
| 103 | 105 | |
| 104 | 106 | return $container->get(ODM::class)->source(static::class); |
| 105 | 107 | } |