protected function lock() { if (!flock($this->fileHandle, LOCK_EX)) { throw new LockAcquireException("Failed to lock the file."); } }