public static function createTempPathNamed($name)
    {
        $dir = static::createTempPath();

        if (!unlink($dir)) {
            // @codeCoverageIgnoreStart
            throw new FileException(
                'The temporary file could not be deleted.'
            );
        }
        // @codeCoverageIgnoreEnd

        if (!mkdir($dir)) {
            // @codeCoverageIgnoreStart
            throw new FileException(
                'A new temporary directory could not be created.'
            );
        }
        // @codeCoverageIgnoreEnd

        $path = $dir . DIRECTORY_SEPARATOR . $name;

        if (!touch($path)) {
            // @codeCoverageIgnoreStart
            throw new FileException(
                'A new temporary file could not be created.'
            );
        }
        // @codeCoverageIgnoreEnd

        return $path;
    }