Get a routing file
@param string $filename
@param string $appname
@return Renderer
@throws \Exception
494682
public function getOneActivity(string $filename, string $appname)
    {
        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK", "results" =>
            $this->getMercureContent($filename, $appname))));
    }
786610
public static function jsonFileContent($filename)
    {
        $fileFullname = Config::getResourceFilePath($filename);

        if (!File::exists($fileFullname)) {
            throw new Exception('The resource file ' . $fileFullname . ' was not found! Perhaps, you need to run PHP artisan resource-file:create [model-name]  or resource-file:from-database [model-name] ');
        }

        return File::get($fileFullname);
    }
355939
public function fetchData($filename, $type) {
        $absPath    = $this->_getAbsPath($filename, $type);
        $sftpStream = $this->getSftpStream($absPath, 'rb');

        $content    = $this->_fetchAndCloseStream($sftpStream);

        if ($content !== false) {
            return $content;
        } else throw new Exception("Could not read {$absPath} on " . $this->getEnvironment());
    }
842584
public function download($filename) {
    if(!empty($this->pdf->getError())) {
      throw new Exception('Could not create PDF: ' . $this->pdf->getError());
    } else {
      $filename = rtrim(File::create()->setName($filename), '.pdf') . '.pdf';
      $this->pdf->send($filename);
    }
  }
989793
protected function find($fileName)
    {
        $fileName = $fileName . '.' . $this->fileExtension;

        foreach ($this->viewPaths as $path) {
            if (file_exists($path . $fileName)) {
                return realpath($path . $fileName);
            }
        }

        throw new \Exception("View $fileName not found.");
    }
671022
public function fetchData($filename, $type) {
        $relPath    = $this->_getRelPath($filename, $type);
        //return $this->_getService()->fetch($relPath);
        $ini        = $this->_getIni();
        $cdnDomain  = $ini->cdn->domain;
        $url        = 'http://' . $cdnDomain . $relPath;

        $content = @file_get_contents($url);
        if ($content === false) {
            throw new Exception("Could not read {$url} on " . $this->getEnvironment());
        }

        // Check for gzipped content
        $unpacked = @gzdecode($content);
        $content = null !== $unpacked && false !== $unpacked ? $unpacked : $content;
        return $content;
    }
491385
public function getUrl(string $filename): GetUrlCommand
    {
        /** @var GetUrlCommand $command */
        $command = $this->builder->build(GetUrlCommand::class);
        $command->byFilename($filename);

        return $command;
    }
98186
private function initExportZipFile($appName)
    {
        $zip = new \ZipArchive();
        $tmpDir = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        $zipFileName = $tmpDir . $appName . '.' . static::FILE_EXTENSION;
        $this->zip = $zip;
        $this->zipFilePath = $zipFileName;

        if (true !== $this->zip->open($zipFileName, \ZipArchive::CREATE)) {
            throw new InternalServerErrorException('Can not create package file for this application.');
        }

        return true;
    }
133596
public static function checkFile($filename)
    {
        $fileContents = (is_file($filename) && is_readable($filename)) ? @file_get_contents($filename) : false;
        if ($fileContents === false) {
            throw new Exception('Failed to load the file '.$filename);
        }

        return static::checkString($fileContents, $filename);
    }
197783
public function getConfigByFilename(string $filename)
    {
        if (!isset($this->config[$filename])) {
            throw new Exception(
                'The file '.$filename.' has not been found',
                $this::ERR_FILE_NOT_FOUND
            );
        }
        
        return $this->config[$filename];
    }
1315403
public function getFile($fileName, $storageName = '')
    {
        //check whether file is set or not
        if ($fileName == '') {
            AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
            throw new Exception(Exception::MSG_NO_FILENAME);
        }

        //build URI
        $strURI = $this->strURIFile . $fileName;
        if ($storageName != '') {
            $strURI .= '?storage=' . $storageName;
        }
        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');

        $outputPath = AsposeApp::$outPutLocation . basename($fileName);
        Utils::saveFile($responseStream, $outputPath);

        return $outputPath;
    }
320213
public function findRoute($routeName)
    {
        // TODO create a route finder ? (same in CmsBundle BreadcrumbBuilder)
        $i18nRouterClass = 'JMS\I18nRoutingBundle\Router\I18nRouterInterface';
        if (interface_exists($i18nRouterClass) && $this->router instanceof $i18nRouterClass) {
            $route = $this->router->getOriginalRouteCollection()->get($routeName);
        } else {
            $route = $this->router->getRouteCollection()->get($routeName);
        }
        if (null === $route) {
            throw new \RuntimeException(sprintf('Route "%s" not found.', $routeName));
        }
        return $route;
    }
1235131
public function render($filename, array $params = array())
    {
        $this->properties = $params;

        $file = $this->scriptPath.DIRECTORY_SEPARATOR.$filename;
        if (!file_exists($file)) {
            $this->logger->error('Could not find template '.$file);

            return '';
        }
        ob_start();
        include $file;

        return ob_get_clean();
    }
792532
protected function getAppConfig($appName, $refresh = true)
    {
        $webApp = $this->api()
            ->getCurrentDeployment($this->getSelectedEnvironment(), $refresh)
            ->getWebApp($appName);

        return AppConfig::fromWebApp($webApp)->getNormalized();
    }
46651
protected function getFile($filename)
    {
        try {
            $file = $this->client->repos()->contents()->show($this->raw['owner']['login'], $this->raw['name'], $filename);
            if ('base64' === $file['encoding']) {
                return base64_decode($file['content'], true);
            }
        } catch (\Exception $e) {
            //file not found
        }
    }
83126
public function load(string $fileName)
    {
        if (!file_exists($fileName)) {
            throw new DriverException('The image ' . $fileName . ' could not be found');
        }

        $handle = @imagecreatefrompng($fileName);
        if (empty($handle)) {
            throw new DriverException('The image ' . $fileName . ' seems to be broken.');
        }

        return $handle;
    }
439244
public function load($filename)
    {
        if (!file_exists($filename)) {
            throw new \Exception('Ini file "' . $filename . '" doesn\'t exist.');
            return false;
        }
        $this->filename = $filename;
        return $this;
    }