Render PhantomJS script template

@param $filePath
@return string
5920
private function renderTemplate($filePath)
    {
        return $this->render(array(
            'url' => $this->url,
            'width' => $this->width,
            'height' => $this->height,
            'fullPage' => $this->fullPage,
            'timeout' => $this->timeout * 1000, // convert into milliseconds
            'waitForImages' => $this->waitForImages,
            'imagesLoadingTimeout' => $this->imagesLoadingTimeout * 1000, // convert into milliseconds
        ), $filePath);
    }
986361
public function RenderTemplate () {
		$formViewScript = $this->form->GetViewScript();
		return $this->Render(
			static::$formsDir,
			is_bool($formViewScript) ? $this->form->GetId() : $formViewScript
		);
	}
1215169
protected function render($filePath, $variables = array()) {
        foreach ($this->_vars as $k => $n) {
            $$k = $n;
        }
        foreach ($variables as $k => $n) {
            $$k = $n;
        }
        require $filePath;
    }
879123
function renderTemplateFile(engine, filePath, context) {
    var loader = engine.getLoader();

    // Resolve the filePath
    var resolvedFilePath = loader.resolve(null, filePath);

    return Promise()
    .then(function() {
        if (!loader.async) {
            return loader.getSource(resolvedFilePath);
        }

        var deferred = Promise.defer();
        loader.getSource(resolvedFilePath, deferred.makeNodeResolver());
        return deferred.promise;
    })
    .then(function(result) {
        if (!result) {
            throw error.TemplateError(new Error('Not found'), {
                filename: filePath
            });
        }

        return render(engine, result.path, result.src, context);
    });

}
1154679
protected function _getManifest( $filepath )
	{
		if( !file_exists( $filepath ) ) {
			throw new MW_Jsb2_Exception( sprintf( 'File does not exists: "%1$s"', $filepath ) );
		}

		if( ( $content = file_get_contents( $filepath ) ) === false ) {
			throw new MW_Jsb2_Exception( sprintf( 'Unable to read content from "%1$s"', $filepath ) );
		}

		if( ( $content = json_decode( $content ) ) === null ) {
			throw new MW_Jsb2_Exception( 'File content is not JSON encoded' );
		}

		return $content;
	}
575143
function RenderScript()
    {
        $templateFile = Path::RemoveExtension($this->TemplateFile());
        $scriptFile = Path::AddExtension($templateFile, 'Script');
        ob_start();
        require Path::AddExtension($scriptFile, 'phtml');
        return ob_get_clean();
    }
1134502
public function generate(InvoiceInterface $invoice, $storagePath = '/tmp')
    {
        // To properly capture a screenshot of the invoice view, we will pipe out to
        // PhantomJS, which is a headless browser. We'll then capture a PNG image
        // of the webpage, which will produce a very faithful copy of the page.
        $viewPath = $this->writeViewForImaging($invoice, $storagePath);
        $this->getPhantomProcess($viewPath)
            ->setTimeout(10)->run();

        return $this->files->get($viewPath);
    }
489598
def _build_filepath_for_phantomcss(filepath):
    
    try:
        if os.path.exists(filepath):
            new_root = '.'.join((os.path.splitext(filepath)[0], 'diff'))
            ext = os.path.splitext(filepath)[1]
            diff_filepath = ''.join((new_root, ext))
            if os.path.exists(diff_filepath):
                print 'removing stale diff: {0}'.format(diff_filepath)
                os.remove(diff_filepath)
            return diff_filepath
        else:
            return filepath
    except OSError, e:
        print e
406165
public function loadFile($filePath)
    {
        $retriever = new UriRetriever();

        try {
            $json = \json_encode($retriever->retrieve('file://' . $filePath));
        } catch (JsonDecodingException $exception) {
            throw new InvalidJsonException($exception->getCode());
        }

        return $json;
    }
364058
public static function loadJsonFromFile($filePath)
    {
        if (!file_exists($filePath)) {
            throw new \RuntimeException("File '{$filePath}' doesn't exist");
        }

        $content = json_decode(file_get_contents($filePath));

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new JsonDecodeException(sprintf(
                'Cannot decode JSON from file "%s" (error: %s)',
                $filePath,
                static::lastJsonErrorMessage()
            ));
        }

        return $content;
    }
812750
protected function renderTemplate($templatePathAndFilename, array $contextVariables)
    {
        $standaloneView = new StandaloneView();
        $standaloneView->setTemplatePathAndFilename($templatePathAndFilename);
        $standaloneView->assignMultiple($contextVariables);
        return $standaloneView->render();
    }
97361
private function compileFiles(string $viewPath)
    {
        $directory = new RecursiveDirectoryIterator($viewPath, FilesystemIterator::SKIP_DOTS);

        foreach (new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST) as $file) {
            /** @var SplFileInfo $file */
            if ($file->isFile() && $file->getExtension() === 'twig') {
                $templateName = substr($file->getPathname(), strlen($viewPath) + 1);
                $templateName = str_replace('\\', '/', $templateName);
                //echo sprintf("Parsing: %s\n", $templateName);
                $this->twig->loadTemplate($templateName);
            }
        }
    }
612628
public static function jsIncTag($path)
    {
        if (strpos($path, 'http') === false and strpos($path, '//') === false) {
            $path = Request::basePath($path);
        }
        return '<script src="' . $path . '" type="text/javascript"></script>' . PHP_EOL;
    }
354263
public static function js($fileName, $base_path = true)
    {
        if (!is_array($fileName))
            $fileName = array($fileName);
        $data = null;
        foreach ($fileName as $file)
        {
            $data .= '<script src="';
            $data .= ($base_path) ? self::getJSLink() : '';
            $data .= $file . '"></script>' . PHP_EOL;
        }
        return $data;
    }
1033259
public function renderJs()
    {
        $jsLines = "\n";
        if ($this->getView()->assetBundles) {
            foreach ($this->getView()->assetBundles as $assetBundle) {
                if (!$assetBundle->sourcePath) {
                    foreach ($assetBundle->js as $jsFile) {
                        $jsLines .= "\n" . Html::jsFile($jsFile, $assetBundle->jsOptions);
                    }
                }
            }
        }
        if ($this->getView()->jsFiles) {
            foreach ($this->getView()->jsFiles as $jsFiles) {
                $jsLines .= implode("\n", $jsFiles);
            }
        }
        if ($this->getView()->js) {
            foreach ($this->getView()->js as $js) {
                $jsLines .= implode("\n", $js);
            }
        }
        return $jsLines;
    }
447606
protected function replaceTemplates($packagePath, $variables)
    {
        $phpEngine = app()->make(PhpEngine::class);

        foreach (File::allFiles($packagePath, true) as $filePath) {
            $filePath = realpath($filePath);

            if (! Str::endsWith($filePath, '.tpl')) {
                continue;
            }

            try {
                $newFileContent = $phpEngine->get($filePath, $variables);
            } catch (Exception $e) {
                $this->error("Template [$filePath] contains syntax errors");
                $this->error($e->getMessage());
                continue;
            }

            $filePathWithoutTplExt = Str::replaceLast(
                '.tpl', '', $filePath
            );

            File::put($filePathWithoutTplExt, $newFileContent);
            File::delete($filePath);
        }
    }
1023337
function View_renderFile(templateName, locals, viewsPath) {
            if (!viewsPath) {
                viewsPath = di.getAlias('viewsPath');
            }
            return this.swig.renderFile(viewsPath + templateName, locals);
        }