@@ -48,6 +48,9 @@ |
||
48 | 48 | return $document; |
49 | 49 | } |
50 | 50 | |
51 | + /** |
|
52 | + * @param DocumentInterface $document |
|
53 | + */ |
|
51 | 54 | public function flatten($document, $prepend = '') |
52 | 55 | { |
53 | 56 | $results = []; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $data = json_decode($data, true); |
35 | 35 | |
36 | - if (!isset($data['_doc']) ){ |
|
36 | + if (!isset($data['_doc'])) { |
|
37 | 37 | throw new DecodeException("Document decoding failed because of bad/corrupted data."); |
38 | 38 | } |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $results = []; |
54 | 54 | |
55 | 55 | foreach ($document as $key => $value) { |
56 | - if (is_array($value) && ! empty($value)) { |
|
56 | + if (is_array($value) && !empty($value)) { |
|
57 | 57 | $results = array_merge($results, $this->flatten($value, $prepend.$key.'.')); |
58 | 58 | } else { |
59 | 59 | $results[$prepend.$key] = $value; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | // If the key doesn't exist at this depth, we will just create an empty array |
68 | 68 | // to hold the next value, allowing us to create the arrays to hold final |
69 | 69 | // values at the correct depth. Then we'll keep digging into the array. |
70 | - if (! isset($attributes[$key]) || ! is_array($attributes[$key])) { |
|
70 | + if (!isset($attributes[$key]) || !is_array($attributes[$key])) { |
|
71 | 71 | $attributes[$key] = []; |
72 | 72 | } |
73 | 73 | $attributes = &$attributes[$key]; |
@@ -84,6 +84,6 @@ |
||
84 | 84 | |
85 | 85 | protected function path($id, $collection, $ext = '.data') |
86 | 86 | { |
87 | - return $this->namespace . DIRECTORY_SEPARATOR . $collection . DIRECTORY_SEPARATOR . $id . $ext; |
|
87 | + return $this->namespace.DIRECTORY_SEPARATOR.$collection.DIRECTORY_SEPARATOR.$id.$ext; |
|
88 | 88 | } |
89 | 89 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Remove all the documents from the collection. |
61 | 61 | * |
62 | - * @return bool |
|
62 | + * @return boolean|null |
|
63 | 63 | */ |
64 | 64 | public function truncate() |
65 | 65 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @param DocumentInterface $document |
73 | 73 | * |
74 | - * @return bool |
|
74 | + * @return string |
|
75 | 75 | */ |
76 | 76 | public function insert(DocumentInterface $document) |
77 | 77 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param mixed $criteria |
104 | 104 | * @param bool $multiple |
105 | 105 | * |
106 | - * @return int The count of the document deleted. |
|
106 | + * @return boolean The count of the document deleted. |
|
107 | 107 | */ |
108 | 108 | public function remove($criteria, $multiple = false) |
109 | 109 | { |
@@ -130,6 +130,9 @@ discard block |
||
130 | 130 | return $this->onMatch($criteria); |
131 | 131 | } |
132 | 132 | |
133 | + /** |
|
134 | + * @param integer $limit |
|
135 | + */ |
|
133 | 136 | protected function onMatch($criteria, $limit = null) |
134 | 137 | { |
135 | 138 | $expression = $this->parser->parse($criteria); |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Mattbit\Flat\Storage\DocumentStore; |
8 | 8 | use Mattbit\Flat\Model\DocumentInterface; |
9 | 9 | use Mattbit\Flat\Query\Expression\ExpressionInterface; |
10 | -use Traversable; |
|
11 | 10 | |
12 | 11 | class Collection implements \IteratorAggregate |
13 | 12 | { |