@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Remove all the documents from the collection. |
55 | 55 | * |
56 | - * @return bool |
|
56 | + * @return boolean|null |
|
57 | 57 | */ |
58 | 58 | public function truncate() |
59 | 59 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param mixed $criteria |
98 | 98 | * @param bool $multiple |
99 | 99 | * |
100 | - * @return int The count of the document deleted. |
|
100 | + * @return boolean The count of the document deleted. |
|
101 | 101 | */ |
102 | 102 | public function remove($criteria, $multiple = false) |
103 | 103 | { |
@@ -124,6 +124,9 @@ discard block |
||
124 | 124 | return $this->onMatch($criteria); |
125 | 125 | } |
126 | 126 | |
127 | + /** |
|
128 | + * @param integer $limit |
|
129 | + */ |
|
127 | 130 | protected function onMatch($criteria, $limit = null) |
128 | 131 | { |
129 | 132 | $expression = $this->parser->parse($criteria); |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Mattbit\Flat; |
4 | 4 | |
5 | -use Mattbit\Flat\Document\Document; |
|
6 | 5 | use Mattbit\Flat\Document\Identifiable; |
7 | 6 | use Mattbit\Flat\Query\Expression\ExpressionInterface; |
8 | 7 | use Mattbit\Flat\Query\Matcher; |
@@ -43,6 +43,9 @@ discard block |
||
43 | 43 | return $this->getOrCreateCollection($name); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $name |
|
48 | + */ |
|
46 | 49 | public function getOrCreateCollection($name) |
47 | 50 | { |
48 | 51 | if (isset($this->collections[$name])) { |
@@ -59,6 +62,9 @@ discard block |
||
59 | 62 | return $this->collections[$name] = new Collection($this, $store, $name); |
60 | 63 | } |
61 | 64 | |
65 | + /** |
|
66 | + * @param Collection $name |
|
67 | + */ |
|
62 | 68 | public function dropCollection($name) |
63 | 69 | { |
64 | 70 | $this->engine->removeCollection($name); |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Mattbit\Flat\Storage; |
4 | 4 | |
5 | -use Mattbit\Flat\Query\Parser; |
|
6 | 5 | use Mattbit\Flat\Query\Matcher; |
7 | 6 | use Mattbit\Flat\Document\Document; |
8 | 7 | use League\Flysystem\FilesystemInterface; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function update($collection, array $criteria, array $updates, $multiple = false) |
58 | 58 | { |
59 | - return $this->onMatch($collection, $criteria, function ($document) use ($updates) { |
|
59 | + return $this->onMatch($collection, $criteria, function($document) use ($updates) { |
|
60 | 60 | $document = array_merge($document, $updates); |
61 | 61 | |
62 | 62 | return $this->insert($document); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function remove($collection, array $criteria, $multiple = false) |
67 | 67 | { |
68 | - return $this->onMatch($collection, $criteria, function ($document, $path) { |
|
68 | + return $this->onMatch($collection, $criteria, function($document, $path) { |
|
69 | 69 | return $this->filesystem->delete($path); |
70 | 70 | }); |
71 | 71 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $results = []; |
76 | 76 | |
77 | - $this->onMatch($collection, $criteria, function ($document) use (&$results) { |
|
77 | + $this->onMatch($collection, $criteria, function($document) use (&$results) { |
|
78 | 78 | $results[] = $document; |
79 | 79 | }, true); |
80 | 80 |