@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @link http://php.net/manual/en/mongogridfs.construct.php |
| 52 | 52 | * @param MongoDB $db Database |
| 53 | 53 | * @param string $prefix [optional] <p>Optional collection name prefix.</p> |
| 54 | - * @param mixed $chunks [optional] |
|
| 54 | + * @param string $chunks [optional] |
|
| 55 | 55 | * @return MongoGridFS |
| 56 | 56 | */ |
| 57 | 57 | public function __construct(MongoDB $db, $prefix = "fs", $chunks = null) |
@@ -128,6 +128,9 @@ discard block |
||
| 128 | 128 | return $fileDocument['_id']; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | + /** |
|
| 132 | + * @param resource $file |
|
| 133 | + */ |
|
| 131 | 134 | private function insertChunksFromFile($file, $fileInfo) |
| 132 | 135 | { |
| 133 | 136 | $length = $fileInfo['length']; |
@@ -143,6 +146,9 @@ discard block |
||
| 143 | 146 | } |
| 144 | 147 | } |
| 145 | 148 | |
| 149 | + /** |
|
| 150 | + * @param resource $file |
|
| 151 | + */ |
|
| 146 | 152 | private function calculateMD5($file, $length) |
| 147 | 153 | { |
| 148 | 154 | // XXX: this could be really a bad idea with big files... |
@@ -180,6 +186,9 @@ discard block |
||
| 180 | 186 | return $metadata; |
| 181 | 187 | } |
| 182 | 188 | |
| 189 | + /** |
|
| 190 | + * @param string $bytes |
|
| 191 | + */ |
|
| 183 | 192 | private function insertChunksFromBytes($bytes, $fileInfo) |
| 184 | 193 | { |
| 185 | 194 | $length = $fileInfo['length']; |
@@ -195,6 +204,10 @@ discard block |
||
| 195 | 204 | } |
| 196 | 205 | } |
| 197 | 206 | |
| 207 | + /** |
|
| 208 | + * @param string $data |
|
| 209 | + * @param integer $chunkNumber |
|
| 210 | + */ |
|
| 198 | 211 | private function insertChunk($id, $data, $chunkNumber) |
| 199 | 212 | { |
| 200 | 213 | $chunk = [ |
@@ -126,6 +126,9 @@ |
||
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + /** |
|
| 130 | + * @param resource $handle |
|
| 131 | + */ |
|
| 129 | 132 | private function writeFromRessource($handle) |
| 130 | 133 | { |
| 131 | 134 | |