Просмотр исходного кода

Merge pull request #161 from emirb/psr2

Follow PSR2 coding standards
Andreas 8 лет назад
Родитель
Сommit
e91ba81fd0

+ 0 - 1
lib/Alcaeus/MongoDbAdapter/Helper/WriteConcern.php

@@ -47,7 +47,6 @@ trait WriteConcern
             'w' => $this->writeConcern->getW(),
             'wtimeout' => $this->writeConcern->getWtimeout(),
         ];
-
     }
 
     /**

+ 1 - 1
lib/Mongo/Mongo.php

@@ -105,7 +105,7 @@ class Mongo extends MongoClient
      * @param bool $ok
      * @return bool returns the former value of slaveOkay for this instance.
      */
-    public function setSlaveOkay ($ok)
+    public function setSlaveOkay($ok)
     {
         $this->notImplemented();
     }

+ 1 - 1
lib/Mongo/MongoClient.php

@@ -236,7 +236,7 @@ class MongoClient
      * @param int|MongoInt64 $id The ID of the cursor to kill.
      * @return bool
      */
-    public function killCursor($server_hash , $id)
+    public function killCursor($server_hash, $id)
     {
         $this->notImplemented();
     }

+ 7 - 7
lib/Mongo/MongoCollection.php

@@ -37,7 +37,7 @@ class MongoCollection
     /**
      * @var MongoDB
      */
-    public $db = NULL;
+    public $db = null;
 
     /**
      * @var string
@@ -170,7 +170,7 @@ class MongoCollection
                 'waitedMS' => 0,
             ];
         } catch (\MongoDB\Driver\Exception\Exception $e) {
-            throw ExceptionConverter::toLegacy($e,'MongoResultException');
+            throw ExceptionConverter::toLegacy($e, 'MongoResultException');
         }
     }
 
@@ -254,7 +254,7 @@ class MongoCollection
      * @param bool $scan_data Only validate indices, not the base collection.
      * @return array Returns the database's evaluation of this object.
      */
-    public function validate($scan_data = FALSE)
+    public function validate($scan_data = false)
     {
         $command = [
             'validate' => $this->name,
@@ -335,7 +335,7 @@ class MongoCollection
                     }
                 }
             } catch (MongoException $e) {
-                if ( ! $continueOnError) {
+                if (! $continueOnError) {
                     throw $e;
                 }
             }
@@ -374,7 +374,7 @@ class MongoCollection
      * @throws MongoCursorException
      * @return boolean
      */
-    public function update(array $criteria , array $newobj, array $options = [])
+    public function update(array $criteria, array $newobj, array $options = [])
     {
         $multiple = isset($options['multiple']) ? $options['multiple'] : false;
         $isReplace = ! \MongoDB\is_first_key_operator($newobj);
@@ -705,7 +705,7 @@ class MongoCollection
      */
     public function getIndexInfo()
     {
-        $convertIndex = function(\MongoDB\Model\IndexInfo $indexInfo) {
+        $convertIndex = function (\MongoDB\Model\IndexInfo $indexInfo) {
             $infos = [
                 'v' => $indexInfo->getVersion(),
                 'key' => $indexInfo->getKey(),
@@ -982,7 +982,7 @@ class MongoCollection
      */
     private function ensureDocumentHasMongoId(&$document)
     {
-        $checkKeys = function($array) {
+        $checkKeys = function ($array) {
             foreach (array_keys($array) as $key) {
                 if (empty($key) && $key !== 0) {
                     throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?');

+ 2 - 1
lib/Mongo/MongoConnectionException.php

@@ -17,6 +17,7 @@ if (class_exists('MongoConnectionException', false)) {
     return;
 }
 
-class MongoConnectionException extends MongoException {
+class MongoConnectionException extends MongoException
+{
 
 }

+ 2 - 1
lib/Mongo/MongoCursorException.php

@@ -17,6 +17,7 @@ if (class_exists('MongoCursorException', false)) {
     return;
 }
 
-class MongoCursorException extends MongoException {
+class MongoCursorException extends MongoException
+{
 
 }

+ 2 - 1
lib/Mongo/MongoCursorTimeoutException.php

@@ -17,6 +17,7 @@ if (class_exists('MongoCursorTimeoutException', false)) {
     return;
 }
 
-class MongoCursorTimeoutException extends MongoCursorException {
+class MongoCursorTimeoutException extends MongoCursorException
+{
 
 }

+ 3 - 3
lib/Mongo/MongoDB.php

@@ -258,7 +258,7 @@ class MongoDB
      * @param bool $backup_original_files [optional] <p>If original files should be backed up.</p>
      * @return array <p>Returns db response.</p>
      */
-    public function repair($preserve_cloned_files = FALSE, $backup_original_files = FALSE)
+    public function repair($preserve_cloned_files = false, $backup_original_files = false)
     {
         $command = [
             'repairDatabase' => 1,
@@ -534,14 +534,14 @@ class MongoDB
                 throw new \Exception('Database name contains invalid characters');
             }
         }
-
     }
 
     /**
      * @param bool $includeSystemCollections
      * @return Closure
      */
-    private function getSystemCollectionFilterClosure($includeSystemCollections = false) {
+    private function getSystemCollectionFilterClosure($includeSystemCollections = false)
+    {
         return function (CollectionInfo $collectionInfo) use ($includeSystemCollections) {
             return $includeSystemCollections || ! preg_match('#^system\.#', $collectionInfo->getName());
         };

+ 2 - 1
lib/Mongo/MongoDuplicateKeyException.php

@@ -21,6 +21,7 @@ if (class_exists('MongoDuplicateKeyException', false)) {
  * <p>(PECL mongo &gt;= 1.5.0)</p>
  * @link http://php.net/manual/en/class.mongoduplicatekeyexception.php
  */
-class MongoDuplicateKeyException extends MongoWriteConcernException {
+class MongoDuplicateKeyException extends MongoWriteConcernException
+{
 
 }

+ 2 - 1
lib/Mongo/MongoException.php

@@ -17,5 +17,6 @@ if (class_exists('MongoException', false)) {
     return;
 }
 
-class MongoException extends Exception {
+class MongoException extends Exception
+{
 }

+ 3 - 1
lib/Mongo/MongoExecutionTimeoutException.php

@@ -21,4 +21,6 @@ if (class_exists('MongoExecutionTimeoutException', false)) {
  * <p>(PECL mongo &gt;= 1.5.0)</p>
  * @link http://php.net/manual/en/class.mongoexecutiontimeoutexception.php
  */
-class MongoExecutionTimeoutException extends MongoException {}
+class MongoExecutionTimeoutException extends MongoException
+{
+}

+ 2 - 3
lib/Mongo/MongoGridFS.php

@@ -291,7 +291,6 @@ class MongoGridFS extends MongoCollection
                 $this->delete($file['_id']);
                 throw new MongoGridFSException('Could not store file: ' . $e->getMessage(), 0, $e);
             }
-
         }
 
         return $file['_id'];
@@ -339,8 +338,8 @@ class MongoGridFS extends MongoCollection
     {
         try {
             $this->chunks->createIndex(['files_id' => 1, 'n' => 1], ['unique' => true]);
-        } catch (MongoDuplicateKeyException $e) {}
-
+        } catch (MongoDuplicateKeyException $e) {
+        }
     }
 
     /**

+ 2 - 1
lib/Mongo/MongoGridFSException.php

@@ -17,6 +17,7 @@ if (class_exists('MongoGridFSException', false)) {
     return;
 }
 
-class MongoGridFSException extends MongoException {
+class MongoGridFSException extends MongoException
+{
 
 }

+ 0 - 1
lib/Mongo/MongoId.php

@@ -197,7 +197,6 @@ class MongoId implements Serializable, TypeInterface, JsonSerializable
      */
     public static function __set_state(array $props)
     {
-
     }
 
     /**

+ 1 - 1
lib/Mongo/MongoLog.php

@@ -123,7 +123,7 @@ class MongoLog
      * <ul>
      * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
      */
-    public static function setCallback(callable $log_function )
+    public static function setCallback(callable $log_function)
     {
         self::$callback = $log_function;
         return true;

+ 3 - 1
lib/Mongo/MongoProtocolException.php

@@ -20,4 +20,6 @@ if (class_exists('MongoProtocolException', false)) {
 /**
  * <p>(PECL mongo &gt;= 1.5.0)</p>
  */
-class MongoProtocolException extends MongoException {}
+class MongoProtocolException extends MongoException
+{
+}

+ 5 - 4
lib/Mongo/MongoResultException.php

@@ -22,15 +22,16 @@ if (class_exists('MongoResultException', false)) {
  * @link http://php.net/manual/en/class.mongoresultexception.php#mongoresultexception.props.document
  *
  */
-class MongoResultException extends MongoException {
+class MongoResultException extends MongoException
+{
     /**
      * Retrieve the full result document
      * http://php.net/manual/en/mongoresultexception.getdocument.php
      * @return array <p>The full result document as an array, including partial data if available and additional keys.</p>
      */
-    public function getDocument () {}
+    public function getDocument()
+    {
+    }
 
     public $document;
-
-
 }