Download the file to a local path.

@param  string  $pathToFile,
@param  string  $name
@param  headers $array
@return void
506161
public function download($pathToFile, $name = null, array $headers = array())
	{
		$response = StaticClient::get($this->offsetGet('_downloadURL'), array(
			'headers' => $headers,
			'timeout' => $this->timeout,
			'save_to' => $pathToFile,
		));

		file_put_contents($pathToFile, $response->getBody()->getStream());
	}
111054
public function add($pathToAdd, $fileName = null)
    {
        if (is_array($pathToAdd)) {
            foreach ($pathToAdd as $key=>$dir) {
                if (!is_int($key)) {
                    $this->add($dir, $key); }
                else {
                    $this->add($dir);
                }
            }
        } elseif ($this->file->isFile($pathToAdd)) {
            if ($fileName) {
                $this->addFile($pathToAdd, $fileName);
            } else {
                $this->addFile($pathToAdd);
            }
        } else {
            $this->addDir($pathToAdd);
        }

        return $this;
    }
127324
protected function searchCache($pathToFile, &$config)
    {
        $cacheIndex = 0;
        if (!isset($config['data'])) {
            $config['data'] = null;
        }
        if (!is_array($config['extras']['cache'])) {
            $config['extras']['cache'] = [];
        }
        if (is_array($this->cacheStack)) {
            for ($cacheIndex = 0; $cacheIndex < $this->cacheDepth; $cacheIndex++) {
                $cache = $this->getCacheClass($cacheIndex);
                if ($cache->isStored($pathToFile)) {
                    $config['data'] = $cache->restore($pathToFile);
                    $this->addCacheExtras($config, $cacheIndex, 'restored');
                    break;
                } else {
                    $this->addCacheExtras($config, $cacheIndex, 'not found');
                }
            }
        }
        $this->saveCache($config, $pathToFile, $cacheIndex);
    }
1097122
protected function setConfigurationFile(string $name, array $headers)
    {
        $this->info('Set plugin configuration...');

        $prefix = trim($headers['plugin_prefix'], '\/_-');
        $from = $this->path($name.'/config/prefix_plugin.php');
        $to = $this->path($name.'/config/'.$prefix.'_plugin.php');

        $this->files->move($from, $to);
        $this->replaceFileContent($to, $headers);
    }
913095
public static function create($name = '', array $header = array(), Temp $temp = null)
	{

		if ($temp == null) {
			$temp = new Temp('csv-table');
		}

		$tmpFile = $temp->createTmpFile($name);
		$csvFile = new self($tmpFile->getPathname());
		// Write header
		if (!empty($header)) {
			$csvFile->writeRow($header);
		}

		// Preserve Temp to prevent deletion!
		$csvFile->setTemp($temp);

		$csvFile->name = $name;

		return $csvFile;
	}
371229
protected function setTranslationFile($name, array $headers)
    {
        $this->info('Set plugin translation file...');

        $textdomain = trim($headers['text_domain'], '\/ _-');
        $from = $this->path($name.'/languages/plugin-textdomain-en_US.po');
        $to = $this->path($name.'/languages/'.$textdomain.'-en_US.po');

        $this->files->move($from, $to);
    }
1307925
public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment')
    {
        $response = new StreamedResponse($callback, 200, $headers);

        if (! is_null($name)) {
            $response->headers->set('Content-Disposition', $response->headers->makeDisposition(
                $disposition,
                $name,
                $this->fallbackName($name)
            ));
        }

        return $response;
    }
718325
protected function toHeader($name, array $properties)
    {
        $result = urlencode($name) . '=' . urlencode($properties['value']);
        if (isset($properties['domain'])) {
            $result .= '; domain=' . $properties['domain'];
        }
        if (isset($properties['path'])) {
            $result .= '; path=' . $properties['path'];
        }
        if (isset($properties['expires'])) {
            if (is_string($properties['expires'])) {
                $timestamp = strtotime($properties['expires']);
            } else {
                $timestamp = (int)$properties['expires'];
            }
            if ($timestamp !== 0) {
                $result .= '; expires=' . gmdate('D, d-M-Y H:i:s e', $timestamp);
            }
        }
        if (isset($properties['secure']) && $properties['secure']) {
            $result .= '; secure';
        }
        if (isset($properties['httponly']) && $properties['httponly']) {
            $result .= '; HttpOnly';
        }
        return $result;
    }
224907
public function loadTranslations($key, $pathToIniFile)
    {
        $path = $pathToIniFile;
        if(!is_file($path)) {
            throw new \InvalidArgumentException(sprintf("Translation file not found into path %s", $path));
        } else {
            $this->translations[$key] = parse_ini_file($path,true);
        }
    }
693532
protected function startChildProcess(string $pathToFile) : Process
    {
        $pathToConfig = $this->config['config_path'];
        $startupCommand = 'exec php ' . $pathToFile . ' -c ' . $pathToConfig;
        $process = new Process($startupCommand);
        $process->start($this->loop);

        // listen to output from child process:
        $process->stdout->on('data', function ($output) {
            $this->onChildProcessOut($output);
        });

        $process->on('exit', function ($exitCode, $termSignal) {
            $this->onChildProcessExit($exitCode, $termSignal);
        });

        return $process;
    }
936014
public function addPathHeader(string $name, $path)
    {
        return $this->add(new PathHeader($name, $path instanceof Address ? $path : new Address($path)));
    }
316271
public function attach($pathToFile, array $options = [])
    {
        if (is_array($pathToFile)) {
            foreach($pathToFile as $attachment) {

                if (isset($attachment['options']) && array_key_exists("options", $attachment)) {
                    $options = $attachment['options'];
                } else {
                    $options = [];
                }
                $this->addAttachment($attachment['path'], $options);
            }
        } else {
            $this->addAttachment($pathToFile, $options);
        }

        return $this;
    }
903755
public static function download($path = false, $extension = false, $name = false) {

        File::download($path, $extension, $name);
    }
150840
public function open($path, $name) {
    $rand = $this->psl['crypt/rand'];

    /* Set some variables we need later. */
    $this->savePath  = $path;
    $this->name      = $name;
    $this->keyCookie = $name.'_secret';

    /* Set current and new ID. */
    if(isset($_COOKIE[$name])) {
      $this->currID = $_COOKIE[$name];
    } else {
      $this->currID = null;
    }
    if($this->sessIdRegen === true || $this->currID === null) {
      $this->newID = $rand->str(128, 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-_.!*#=%');
    } else {
      $this->newID = $this->currID;
    }

    /* Set cookie with new session ID. */
    $cookieParam = session_get_cookie_params();
    setcookie(
        $name,
        $this->newID,
        $cookieParam['lifetime'],
        $cookieParam['path'],
        $cookieParam['domain'],
        $cookieParam['secure'],
        $cookieParam['httponly']
    );

    /* If we don't have a encryption key, create one. */
    if(!isset($_COOKIE[$this->keyCookie])) {
      /* Create a secret used for encryption of session. */
      $this->setSecret();
    } else {
      $this->secret = base64_decode($_COOKIE[$this->keyCookie]);
    }
    return true;
  }
647611
public function download($name,$path){
        $ruta = $this->getFullPath().$path.$name;
        if( $this->config['debug'] ) $this->_log('$ruta - '.$ruta);
        if($this->validNameFile($name) && file_exists($ruta) && is_file($ruta) ){
            $response = new Response(file_get_contents($ruta));
            $response->headers->set('Content-Type', 'application/octet-stream');
            $d = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT,$name);
            $response->headers->set('Content-Disposition', $d);
            $response->send();
        }else{
            exit();
            // return null;
        }
    }
1299767
public static function bind( $name, $path = null ) 
	{
		if ( is_array( $name ) ) 
		{
			static::$classes = array_merge( static::$classes, $name ); return;
		}
		static::$classes[$name] = $path;
	}
964229
private function open($pathToFile)
    {
        $this->pathToFile = $pathToFile;
        if (!file_exists($this->pathToFile)) {
            throw new ImageException("File " . ($this->pathToFile) . " not found.", ImageException::AccessException);
        }
        $tmpImageSize = getimagesize($this->pathToFile);
        $this->width = (int)$tmpImageSize[0];
        $this->height = (int)$tmpImageSize[1];
        $this->type = (int)$tmpImageSize[2];
        switch ($this->type) {
            case self::GIF:
                $this->resource = imagecreatefromgif($this->pathToFile);
                break;
            case self::JPG:
                $this->resource = imagecreatefromjpeg($this->pathToFile);
                break;
            case self::PNG:
                $this->resource = imagecreatefrompng($this->pathToFile);
                break;
            case self::BMP:
                $this->resource = imagecreatefromwbmp($this->pathToFile);
                break;
            default:
                throw new ImageException("Unknown type of file " . ($this->pathToFile) . ".", ImageException::UnsupportedFormatException);
                break;
        }
    }