Retrieves zipped folder from ZipArchive.

@param $file

@return null|\ZipArchive
@throws \DreamFactory\Core\Exceptions\InternalServerErrorException
973928
public function getZipFromZip($file)
    {
        $fh = $this->zip->getStream($file);
        if (false !== $fh) {
            $contents = null;
            while (!feof($fh)) {
                $contents .= fread($fh, 2);
            }
            $tmpDir = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
            $zipFile = $tmpDir . md5($file) . time() . '.' . static::FILE_EXTENSION;
            file_put_contents($zipFile, $contents);

            $zip = new \ZipArchive();
            if (true !== $zip->open($zipFile)) {
                throw new InternalServerErrorException('Error opening zip file ' . $file . '.');
            }
            $this->destructible[] = $zipFile;

            return $zip;
        }

        return null;
    }
32697
public function load($file)
    {
        $dir = $this->getDir();

        if (!$this->filesystem->exists($dir . $file)) {
            throw new NotFoundException('File not found.');
        }

        return file_get_contents($dir . $file);
    }
570876
public static function file( $file )
	{
		$params = array_merge( static::$params, array(
			'time' => time(),
			'fingerprint' => \CCSession::fingerprint(),
			'random' => CCStr::random(),
		));
		
		foreach( $params as $param => $value )
		{
			$file = str_replace( ':'.$param, $value, $file );
		}
		
		return $file;
	}
1192667
protected function getFileContents($file)
    {
        $filePath = $this->directory.'/'.$file;

        if (!file_exists($filePath)) {
            throw new InvalidArgumentException("The file [$filePath] does not exist.");
        }

        return json_decode(file_get_contents($filePath), true);
    }
715046
public static function getAbsFile($file)
    {
        // If already absolute
        if (self::is_absolute($file)) {
            return $file;
        }

        // If path is relative to public folder search there first
        if (self::publicDir()) {
            $path = Path::join(self::publicFolder(), $file);
            if (file_exists($path)) {
                return $path;
            }
        }

        // Default to base folder
        return Path::join(self::baseFolder(), $file);
    }
510649
public function getFile($file = null, $md5 = null)
    {
        //====================================================================//
        // Stack Trace
        Splash::log()->trace();

        //====================================================================//
        // PHPUNIT Exception => Look First in Local FileSystem
        //====================================================================//
        if (defined('SPLASH_DEBUG') && !empty(SPLASH_DEBUG)) {
            $filePath = dirname(__DIR__)."/Resources/files/".$file;
            if (is_file($filePath)) {
                $file = $this->readFile($filePath, $md5);

                return is_array($file) ? $file : false;
            }
            $imgPath = dirname(__DIR__)."/Resources/img/".$file;
            if (is_file($imgPath)) {
                $file = $this->readFile($imgPath, $md5);

                return is_array($file) ? $file : false;
            }
        }

        //====================================================================//
        // Initiate Tasks parameters array
        $params = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
        $params->file = $file;
        $params->md5 = $md5;
        //====================================================================//
        // Add Task to Ws Task List
        Splash::ws()->addTask(SPL_F_GETFILE, $params, Splash::trans("MsgSchRemoteReadFile", (string) $file));

        //====================================================================//
        // Execute Task
        $response = Splash::ws()->call(SPL_S_FILE);

        //====================================================================//
        // Return First Task Result
        return Splash::ws()->getNextResult($response);
    }
1031215
public function getConfigFile($file = null)
    {
        $file = $file ?: $this->configFile;

        return file_exists($file) ? $file : $this->getConfigFileStub();
    }
1090565
public static function loadFile($file)
    {
        $json = new Json();

        return self::create($json->decodeFile($file), $json);
    }
980037
public function addArchive(string $file): self
    {
        if (!\is_file($file)) {
            throw new \InvalidArgumentException(\sprintf('Archive not found: "%s"', $file));
        }
        
        if (!\is_readable($file)) {
            throw new \RuntimeException(\sprintf('Archive not readable: "%s"', $file));
        }
        
        $zip = new \ZipArchive();
        $zip->open($file);
        
        try {
            for ($i = 0; $i < $zip->numFiles; $i++) {
                $stat = (array) $zip->statIndex($i);
                
                // This will skip empty files as well... need a better way to this eventually.
                if (empty($stat['size'])) {
                    continue;
                }
                
                $name = $zip->getNameIndex($i);
                
                // Cap memory at 256KB to allow for large deployments when necessary.
                $stream = new StringStream('', 262144);
                $resource = $zip->getStream($name);
                
                try {
                    while (!\feof($resource)) {
                        $stream->write(\fread($resource, 8192));
                    }
                    
                    $stream->rewind();
                } finally {
                    @\fclose($resource);
                }
                
                $this->resources[\trim(\str_replace('\\', '/', $name), '/')] = $stream;
            }
        } finally {
            @$zip->close();
        }
        
        return $this;
    }
146772
public function get($file)
    {
        $path = $this->getPath($file);

        if (! file_exists($path)) {
            throw new FileDoesNotExists;
        }

        return file_get_contents($path);
    }
188448
public static function getContent($file)
    {
        if (!File::exists($file)) {
            throw new IOException(sprintf("File %s does not exist", $file));
        }

        $content = file_get_contents($file);

        if (false === $content) {
            throw new IOException(sprintf("Cannot get content from file %s", $file));
        }

        return $content;
    }
680352
public function zipResourceFile($file, $resource)
    {
        if (!$this->zip->addFromString($file, json_encode($resource, JSON_UNESCAPED_SLASHES))) {
            throw new InternalServerErrorException("Failed to add $file to the Zip Archive.");
        }
    }
301891
protected function extractCacheContent($file) {
		if ($this->_cacheContent !== null) {
			return $this->_cacheContent;
		}

		$this->_cacheContent = (string)file_get_contents($file);

		return $this->_cacheContent;
	}
546179
private function getFileContents($file) {
    if (file_exists($file) === FALSE) {
      return NULL;
    }

    $contents = file_get_contents($file);
    if ($contents === FALSE) {
      return NULL;
    }

    return $contents;
  }
1249194
public function getFile($file) {
		$timeStamp = microtime(true);
		if($file instanceof BundleEntity\File){
			return new ModelResponse($file, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, microtime(true));
		}
		$result = null;
		switch($file){
			case is_numeric($file):
				$result = $this->em->getRepository($this->entity['f']['name'])->findOneBy(array('id' => $file));
				break;
			case is_string($file):
				$result = $this->em->getRepository($this->entity['f']['name'])->findOneBy(array('url_key' => $file));
				if(is_null($result)){
					$result = $this->em->getRepository($this->entity['f']['name'])->findOneBy(array('source_original' => $file));
					if(is_null($result)){
						$result = $this->em->getRepository($this->entity['f']['name'])->findOneBy(array('source_preview' => $file));
					}
				}
				break;
		}
		if(is_null($result)){
			return new ModelResponse($result, 0, 0, null, true, 'E:D:002', 'Unable to find request entry in database.', $timeStamp, microtime(true));
		}

		return new ModelResponse($result, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, microtime(true));
	}
333578
protected function slice($file)
    {
        if (empty($this->storage[$file]))
        {
            $require = $this->requireFile($file);

            $this->storage[$file] = $this->make($require);
        }

        return $this->storage[$file];
    }
1357988
protected function getPath($file = null)
    {
        $path = Configure::readOrFail('Thumber.target');

        return $file ? $path . DS . $file : $path;
    }