src/Util/VolatileDirectory.php
public function getPath()
    {
        if ($this->path === null) {
            $parentDirectory = $this->parentDirectory;
            if ($parentDirectory === '') {
                $parentDirectory = static::getSystemTemporaryDirectory();
            } else {
                if (!is_dir($parentDirectory)) {
                    throw new Exception\PathNotFound($parentDirectory);
                }
            }
            if (!is_writable($parentDirectory)) {
                throw new Exception\PathNotWritable($parentDirectory);
            }
            for (; ;) {
                $tempNam = @tempnam($parentDirectory, 'PCH');
                if ($tempNam === false) {
                    throw new Exception\PathNotCreated("{$parentDirectory}/<TEMPORARY>");
                }
                @unlink($tempNam);
                if (@mkdir($tempNam)) {
                    break;
                }
            }
            $this->path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $tempNam), '/');
        }

        return $this->path;
    }
public function getPath()
    {
        if ($this->path === null) {
            $parentDirectory = $this->parentDirectory;
            if ($parentDirectory === '') {
                $parentDirectory = static::getSystemTemporaryDirectory();
            } else {
                if (!is_dir($parentDirectory)) {
                    throw new Exception\PathNotFound($parentDirectory);
                }
            }
            if (!is_writable($parentDirectory)) {
                throw new Exception\PathNotWritable($parentDirectory);
            }
            for (; ;) {
                $tempNam = @tempnam($parentDirectory, 'PCH');
                if ($tempNam === false) {
                    throw new Exception\PathNotCreated("{$parentDirectory}/<TEMPORARY>");
                }
                @unlink($tempNam);
                if (@mkdir($tempNam)) {
                    break;
                }
            }
            $this->path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $tempNam), '/');
        }

        return $this->path;
    }
public function getPath ( ) { if ( $ this -> path === null ) { $ parentDirectory = $ this -> parentDirectory ; if ( $ parentDirectory === '' ) { $ parentDirectory = static :: getSystemTemporaryDirectory ( ) ; } else { if ( ! is_dir ( $ parentDirectory ) ) { throw new Exception \ PathNotFound ( $ parentDirectory ) ; } } if ( ! is_writable ( $ parentDirectory ) ) { throw new Exception \ PathNotWritable ( $ parentDirectory ) ; } for ( ; ; ) { $ tempNam = @ tempnam ( $ parentDirectory , 'PCH' ) ; if ( $ tempNam === false ) { throw new Exception \ PathNotCreated ( "{$parentDirectory}/<TEMPORARY>" ) ; } @ unlink ( $ tempNam ) ; if ( @ mkdir ( $ tempNam ) ) { break ; } } $ this -> path = rtrim ( str_replace ( DIRECTORY_SEPARATOR , '/' , $ tempNam ) , '/' ) ; } return $ this -> path ; }
Get the path to the volatile directory.

@throws \ComposerPatcher\Exception\PathNotFound when the parent directory is not specified and the system temporary directory can't be retrieved or when it does not exist
@throws \ComposerPatcher\Exception\PathNotFound when $parentDirectory is supplied but it does not exist
@throws \ComposerPatcher\Exception\PathNotWritable when the directory where the volatile directory will be created is not writable
@throws \ComposerPatcher\Exception\PathNotCreated when the temporary directory could not be created

@return string
Get the path to the volatile directory .