@@ -12,7 +12,6 @@ |
||
| 12 | 12 | namespace Sokil\Mongo; |
| 13 | 13 | |
| 14 | 14 | use Sokil\Mongo\Pipeline\GroupStage; |
| 15 | - |
|
| 16 | 15 | use Sokil\Mongo\ArrayableInterface; |
| 17 | 16 | |
| 18 | 17 | class Pipeline implements |
@@ -172,6 +172,9 @@ |
||
| 172 | 172 | return $this->whereHasType($field, FieldType::NULL); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | + /** |
|
| 176 | + * @param string $condition |
|
| 177 | + */ |
|
| 175 | 178 | public function whereJsCondition($condition) |
| 176 | 179 | { |
| 177 | 180 | return $this->where('$where', $condition); |
@@ -132,11 +132,17 @@ |
||
| 132 | 132 | return $this->options; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | + /** |
|
| 136 | + * @param string $name |
|
| 137 | + */ |
|
| 135 | 138 | public function getOption($name, $default = null) |
| 136 | 139 | { |
| 137 | 140 | return isset($this->options[$name]) ? $this->options[$name] : $default; |
| 138 | 141 | } |
| 139 | 142 | |
| 143 | + /** |
|
| 144 | + * @param string $name |
|
| 145 | + */ |
|
| 140 | 146 | public function hasOption($name) |
| 141 | 147 | { |
| 142 | 148 | return isset($this->options[$name]); |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | /** |
| 459 | 459 | * Store document to pool |
| 460 | 460 | * |
| 461 | - * @param array $document |
|
| 461 | + * @param Document $document |
|
| 462 | 462 | * @return \Sokil\Mongo\Collection |
| 463 | 463 | */ |
| 464 | 464 | public function addDocumentToDocumentPool(Document $document) |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | * |
| 617 | 617 | * @param string|\MongoId $id |
| 618 | 618 | * @param callable $callable cursor callable used to configure cursor |
| 619 | - * @return \Sokil\Mongo\Document|array|null |
|
| 619 | + * @return Document |
|
| 620 | 620 | */ |
| 621 | 621 | public function getDocumentDirectly($id, $callable = null) |
| 622 | 622 | { |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | * Check if document belongs to collection |
| 637 | 637 | * |
| 638 | 638 | * @param \Sokil\Mongo\Document $document |
| 639 | - * @return type |
|
| 639 | + * @return boolean |
|
| 640 | 640 | */ |
| 641 | 641 | public function hasDocument(Document $document) |
| 642 | 642 | { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @param Client $client |
| 57 | - * @param \MongoDB|string $database |
|
| 57 | + * @param string $database |
|
| 58 | 58 | */ |
| 59 | 59 | public function __construct(Client $client, $database) |
| 60 | 60 | { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | /** |
| 155 | 155 | * Reset specified mapping |
| 156 | 156 | * |
| 157 | - * @return \Sokil\Mongo\Client |
|
| 157 | + * @return Database |
|
| 158 | 158 | */ |
| 159 | 159 | public function resetMapping() |
| 160 | 160 | { |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @param string|array $name collection name or array like [collectionName => collectionClass, ...] |
| 170 | 170 | * @param string|array|Definition|null $classDefinition if $name is string, then full class name or array with parameters, else omitted |
| 171 | - * @return \Sokil\Mongo\Client |
|
| 171 | + * @return Database |
|
| 172 | 172 | */ |
| 173 | 173 | public function map($name, $classDefinition = null) |
| 174 | 174 | { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @param string $name name of collection |
| 231 | 231 | * @param array $defaultDefinition definition used when no definition found for defined class |
| 232 | 232 | * @throws Exception |
| 233 | - * @return string|array name of class or array of class definition |
|
| 233 | + * @return string name of class or array of class definition |
|
| 234 | 234 | */ |
| 235 | 235 | private function getCollectionDefinition($name, array $defaultDefinition = null) |
| 236 | 236 | { |
@@ -30,6 +30,9 @@ discard block |
||
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $fieldName |
|
| 35 | + */ |
|
| 33 | 36 | public function push($fieldName, $value) |
| 34 | 37 | { |
| 35 | 38 | // prepasre to store |
@@ -57,6 +60,9 @@ discard block |
||
| 57 | 60 | return $this; |
| 58 | 61 | } |
| 59 | 62 | |
| 63 | + /** |
|
| 64 | + * @param string $fieldName |
|
| 65 | + */ |
|
| 60 | 66 | public function pushEach($fieldName, array $values) |
| 61 | 67 | { |
| 62 | 68 | // value must be list, not dictionary |
@@ -335,6 +341,9 @@ discard block |
||
| 335 | 341 | return $this; |
| 336 | 342 | } |
| 337 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $operation |
|
| 346 | + */ |
|
| 338 | 347 | public function get($operation, $fieldName = null) |
| 339 | 348 | { |
| 340 | 349 | if ($fieldName) { |
@@ -370,7 +379,7 @@ discard block |
||
| 370 | 379 | /** |
| 371 | 380 | * Transform operator in different formats to canonical array form |
| 372 | 381 | * |
| 373 | - * @param mixed $mixed |
|
| 382 | + * @param callable $mixed |
|
| 374 | 383 | * @return array |
| 375 | 384 | * @throws \Sokil\Mongo\Exception |
| 376 | 385 | */ |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @param string $selector |
| 162 | 162 | * @param string|callable $className string class name or closure, which accept data and return string class name |
| 163 | - * @return object representation of document with class, passed as argument |
|
| 163 | + * @return null|Structure representation of document with class, passed as argument |
|
| 164 | 164 | * @throws \Sokil\Mongo\Exception |
| 165 | 165 | */ |
| 166 | 166 | public function getObject($selector, $className = '\Sokil\Mongo\Structure') |
@@ -298,6 +298,9 @@ discard block |
||
| 298 | 298 | return $this; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | + /** |
|
| 302 | + * @param string $selector |
|
| 303 | + */ |
|
| 301 | 304 | public function has($selector) |
| 302 | 305 | { |
| 303 | 306 | $pointer = &$this->data; |
@@ -361,6 +364,9 @@ discard block |
||
| 361 | 364 | return (array) $value; |
| 362 | 365 | } |
| 363 | 366 | |
| 367 | + /** |
|
| 368 | + * @param string $selector |
|
| 369 | + */ |
|
| 364 | 370 | public function unsetField($selector) |
| 365 | 371 | { |
| 366 | 372 | // modify |