protected function getHandle()
{
if ($this->_handle === null) {
if (isset(static::$_handles[$this->_path])) {
$this->_handle = static::$_handles[$this->_path];
} else {
if (!file_exists($this->_path)) {
if (file_put_contents($this->_path, 'lock') === false) {
throw new Exception('failed create lock file');
}
}
$this->_handle = fopen($this->_path, 'r+');
}
}
return $this->_handle;
}