Explorar el Código

Remove magic handling for undefined members

Andreas Braun hace 10 años
padre
commit
29f9414aa0
Se han modificado 3 ficheros con 2 adiciones y 12 borrados
  1. 0 2
      lib/Mongo/MongoCollection.php
  2. 0 2
      lib/Mongo/MongoDB.php
  3. 2 8
      lib/Mongo/MongoId.php

+ 0 - 2
lib/Mongo/MongoCollection.php

@@ -108,8 +108,6 @@ class MongoCollection
         if ($name === 'w' || $name === 'wtimeout') {
         if ($name === 'w' || $name === 'wtimeout') {
             $this->setWriteConcernFromArray([$name => $value] + $this->getWriteConcern());
             $this->setWriteConcernFromArray([$name => $value] + $this->getWriteConcern());
             $this->createCollectionObject();
             $this->createCollectionObject();
-        } else {
-            $this->$name = $value;
         }
         }
     }
     }
 
 

+ 0 - 2
lib/Mongo/MongoDB.php

@@ -100,8 +100,6 @@ class MongoDB
         if ($name === 'w' || $name === 'wtimeout') {
         if ($name === 'w' || $name === 'wtimeout') {
             $this->setWriteConcernFromArray([$name => $value] + $this->getWriteConcern());
             $this->setWriteConcernFromArray([$name => $value] + $this->getWriteConcern());
             $this->createDatabaseObject();
             $this->createDatabaseObject();
-        } else {
-            $this->$name = $value;
         }
         }
     }
     }
 
 

+ 2 - 8
lib/Mongo/MongoId.php

@@ -23,8 +23,6 @@ class MongoId implements Serializable, TypeInterface
      */
      */
     private $objectID;
     private $objectID;
 
 
-    private $attributes = [];
-
     /**
     /**
      * Creates a new id
      * Creates a new id
      *
      *
@@ -88,7 +86,7 @@ class MongoId implements Serializable, TypeInterface
             return (string) $this->objectID;
             return (string) $this->objectID;
         }
         }
 
 
-        return $this->attributes[$name];
+        return null;
     }
     }
 
 
     /**
     /**
@@ -101,8 +99,6 @@ class MongoId implements Serializable, TypeInterface
             trigger_error("The '\$id' property is read-only", E_DEPRECATED);
             trigger_error("The '\$id' property is read-only", E_DEPRECATED);
             return;
             return;
         }
         }
-
-        $this->attributes[$name] = $value;
     }
     }
 
 
     /**
     /**
@@ -111,7 +107,7 @@ class MongoId implements Serializable, TypeInterface
      */
      */
     public function __isset($name)
     public function __isset($name)
     {
     {
-        return $name === 'id' || array_key_exists($name, $this->attributes);
+        return $name === 'id';
     }
     }
 
 
     /**
     /**
@@ -123,8 +119,6 @@ class MongoId implements Serializable, TypeInterface
             trigger_error("The '\$id' property is read-only", E_DEPRECATED);
             trigger_error("The '\$id' property is read-only", E_DEPRECATED);
             return;
             return;
         }
         }
-
-        unset($this->attributes[$name]);
     }
     }
 
 
     /**
     /**