/** * 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; }
public function testType() { $this->assertEquals('write', $this->lock->getType()); }