Completed
Pull Request — master (#15)
by
unknown
11:37
created
lib/Mongo/MongoGridFSException.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,6 +13,7 @@
 block discarded – undo
13 13
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 14
  */
15 15
 
16
-class MongoGridFSException extends MongoException {
16
+class MongoGridFSException extends MongoException
17
+{
17 18
 
18 19
 }
Please login to merge, or discard this patch.
lib/Mongo/MongoProtocolException.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,4 +16,6 @@
 block discarded – undo
16 16
 /**
17 17
  * <p>(PECL mongo &gt;= 1.5.0)</p>
18 18
  */
19
-class MongoProtocolException extends MongoException {}
19
+class MongoProtocolException extends MongoException
20
+{
21
+}
Please login to merge, or discard this patch.
lib/Mongo/MongoRegex.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             return;
44 44
         }
45 45
 
46
-        if (! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) {
46
+        if ( ! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) {
47 47
             throw new MongoException('invalid regex', 9);
48 48
         }
49 49
 
Please login to merge, or discard this patch.
lib/Mongo/MongoWriteConcernException.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,11 +17,14 @@
 block discarded – undo
17 17
  * <p>(PECL mongo &gt;= 1.5.0)</p>
18 18
  * @link http://php.net/manual/en/class.mongowriteconcernexception.php#class.mongowriteconcernexception
19 19
  */
20
-class MongoWriteConcernException extends MongoCursorException {
20
+class MongoWriteConcernException extends MongoCursorException
21
+{
21 22
     /**
22 23
      * Get the error document
23 24
      * @link http://php.net/manual/en/mongowriteconcernexception.getdocument.php
24 25
      * @return array <p>A MongoDB document, if available, as an array.</p>
25 26
      */
26
-    public function getDocument() {}
27
+    public function getDocument()
28
+    {
29
+}
27 30
 }
Please login to merge, or discard this patch.
lib/Mongo/MongoGridFS.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function find(array $query = array(), array $fields = array())
93 93
     {
94
-        $cursor = new MongoGridFSCursor($this, $this->db->getConnection(), (string)$this, $query, $fields);
94
+        $cursor = new MongoGridFSCursor($this, $this->db->getConnection(), (string) $this, $query, $fields);
95 95
         $cursor->setReadPreference($this->getReadPreference());
96 96
 
97 97
         return $cursor;
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
             $shortName = basename($filename);
113 113
             $filename = fopen($filename, 'r');
114 114
         }
115
-        if (! is_resource($filename)) {
115
+        if ( ! is_resource($filename)) {
116 116
             throw new \InvalidArgumentException();
117 117
         }
118 118
         $length = fstat($filename)['size'];
119
-        $extra['chunkSize'] = isset($extra['chunkSize']) ? $extra['chunkSize']: self::DEFAULT_CHUNK_SIZE;
119
+        $extra['chunkSize'] = isset($extra['chunkSize']) ? $extra['chunkSize'] : self::DEFAULT_CHUNK_SIZE;
120 120
         $extra['_id'] = isset($extra['_id']) ?: new MongoId();
121 121
         $extra['length'] = $length;
122 122
         $extra['md5'] = isset($md5) ? $md5 : $this->calculateMD5($filename, $length);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     public function findOne(array $query = array(), array $fields = array())
217 217
     {
218 218
         $file = parent::findOne($query, $fields);
219
-        if (! $file) {
219
+        if ( ! $file) {
220 220
             return;
221 221
         }
222 222
         return new MongoGridFSFile($this, $file);
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         if (is_string($id)) {
253 253
             $id = new MongoId($id);
254 254
         }
255
-        if (! $id instanceof MongoId) {
255
+        if ( ! $id instanceof MongoId) {
256 256
             return false;
257 257
         }
258 258
         $this->chunks->remove(['file_id' => $id], ['justOne' => false]);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      */
269 269
     public function storeUpload($name, array $metadata = [])
270 270
     {
271
-        if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
271
+        if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
272 272
             throw new \InvalidArgumentException();
273 273
         }
274 274
         $metadata += ['filename' => $_FILES[$name]['name']];
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         if (is_string($id)) {
287 287
             $id = new MongoId($id);
288 288
         }
289
-        if (! $id instanceof MongoId) {
289
+        if ( ! $id instanceof MongoId) {
290 290
             return false;
291 291
         }
292 292
         return $this->findOne(['_id' => $id]);
Please login to merge, or discard this patch.
Doc Comments   +13 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @link http://php.net/manual/en/mongogridfs.construct.php
54 54
      * @param MongoDB $db Database
55 55
      * @param string $prefix [optional] <p>Optional collection name prefix.</p>
56
-     * @param mixed $chunks  [optional]
56
+     * @param string $chunks  [optional]
57 57
      * @return MongoGridFS
58 58
      */
59 59
     public function __construct(MongoDB $db, $prefix = "fs", $chunks = null)
@@ -280,6 +280,9 @@  discard block
 block discarded – undo
280 280
         $this->createIndex(['filename' => 1, 'uploadDate' => 1]);
281 281
     }
282 282
 
283
+    /**
284
+     * @param resource $file
285
+     */
283 286
     private function insertChunksFromFile($file, $fileInfo)
284 287
     {
285 288
         $length = $fileInfo['length'];
@@ -295,6 +298,9 @@  discard block
 block discarded – undo
295 298
         }
296 299
     }
297 300
 
301
+    /**
302
+     * @param resource $file
303
+     */
298 304
     private function calculateMD5($file)
299 305
     {
300 306
         // XXX: this could be really a bad idea with big files...
@@ -303,6 +309,9 @@  discard block
 block discarded – undo
303 309
         return md5($data);
304 310
     }
305 311
 
312
+    /**
313
+     * @param string $bytes
314
+     */
306 315
     private function insertChunksFromBytes($bytes, $fileInfo)
307 316
     {
308 317
         $length = $fileInfo['length'];
@@ -316,6 +325,9 @@  discard block
 block discarded – undo
316 325
         }
317 326
     }
318 327
 
328
+    /**
329
+     * @param integer $chunkNumber
330
+     */
319 331
     private function insertChunk($id, $data, $chunkNumber)
320 332
     {
321 333
         $chunk = [
Please login to merge, or discard this patch.