protected function throwIfOperationNotInBaseFolder($operationFolderPath) { $operationFolderRealPath = realpath($operationFolderPath); $isInBaseFolder = strpos($operationFolderRealPath, $this->baseFolderRealPath) === 0; if (!$isInBaseFolder) { throw new IOException("Cannot perform I/O operation outside of the base folder: {$this->baseFolderRealPath}"); } }