예제 #1
0
 /**
  * XXX: Calling "setType" for writing key value (?)
  * @return string
  */
 public function write($value)
 {
     if ($value === NULL) {
         $this->database->deleteKey($this->key);
     } else {
         $this->database->setType($this->key, strval($value));
     }
 }
예제 #2
0
 private function lazyInitialization()
 {
     $this->data = new \ArrayObject();
     $this->changes = new \ArrayObject();
     // use type filter from DB
     $dbType = count($this->types) === 1 ? $this->types[0] : NULL;
     $rawData = $this->database->getAll($dbType);
     if (!is_array($rawData)) {
         return;
     }
     foreach ($rawData as $key => $row) {
         if (count($this->types) === 1) {
             unset($row['type']);
         } elseif (count($this->types) > 1 && !in_array($row['type'], $this->types)) {
             // skip record if not in required set of types
             continue;
         }
         if ($this->filter === NULL) {
             $this->data[$key] = new \ArrayObject($row);
         } elseif (call_user_func($this->filter, $key, $row)) {
             $this->data[$key] = new \ArrayObject($row);
         }
     }
 }
예제 #3
0
 public function testGetAuthorizationAttribute()
 {
     $this->assertEquals('MOCKDB', $this->object->getAuthorizationAttribute('dbname'));
     $this->assertNull($this->object->getAuthorizationAttribute('seklfhsjkd'));
 }