Ejemplo n.º 1
0
 /**
  * Add an lock to the list of active locks
  *
  * @param Lock $lock The lock to add
  */
 private function add(Lock $lock)
 {
     $index = count($this->locks);
     if ($lock->getToken()) {
         $this->tokens[$lock->getToken()] = $index;
     }
     $type = $lock->getType();
     $scope = $lock->getScope();
     $hashKey = $this->getHashKey($type, $scope);
     if (!isset($this->index[$type])) {
         $this->index[$type] = array();
     }
     if (!isset($this->index[$hashKey])) {
         $this->index[$hashKey] = array();
     }
     $this->index[$type][] = $index;
     $this->index[$hashKey][] = $index;
     $this->locks[] = $lock;
 }
Ejemplo n.º 2
0
 public function testToken()
 {
     $this->lock->setToken('opaquelocktoken:f81d4fae-7dec-11d0-a765-00a0c91e6bf6');
     $this->assertEquals('opaquelocktoken:f81d4fae-7dec-11d0-a765-00a0c91e6bf6', $this->lock->getToken());
 }