Build

@param   string $path
@param   array $vars

@return  string
@throws Exception
169416
public function build(string $path, array $vars = []): string
    {
        $this->path = $path;
        $this->vars = $vars;

        unset($path, $vars);

        ob_start();

        extract($this->vars);

        try {
            /** @noinspection PhpIncludeInspection */
            include $this->path;
        } catch (Exception $e) {
            ob_get_clean();
            throw $e;
        }

        $this->path = $this->vars = null;

        return ob_get_clean();
    }
1359086
public function renderFile($path, array $vars = [])
    {
        $fallback = function () use ($path, $vars) {
            return $this->renderFileWithPhp($path, $vars);
        };

        if ($this->getDefaultOption('pugjs')) {
            return $this->renderFileWithJs($path, $vars, $fallback);
        }

        return call_user_func($fallback);
    }
991626
protected function buildRequest($path)
    {
        $request = new Request();
        $apiToken = $this->getApiToken();
        if ($apiToken !== '') {
            $request->getHeaders()->addHeaders(['API-Token' => $apiToken]);
        }
        $path = (string) $path;
        if ($path !== '' && $path[0] !== '/') {
            $path = '/' . $path;
        }
        $request->setUri($this->getEntryPoint() . $path);

        return $request;
    }
1176958
protected function setFile($path = NULL, $template = NULL, array $vars = []) {
    $this->addFile()
      ->path($path)
      ->template($template)
      ->vars($vars);
  }
549373
protected function buildPath(array $parts, array $params, $optional = false) {
        $path = '';
        foreach ($parts as $part) {
            switch ($part[0]) {
                case 'literal':
                    $path .= $part[1];
                    break;
                case 'parameter':
                    if (!isset($params[$part[1]])) {
                        if (!$optional) {
                            throw new Exception(
                                __('Missing parameter "{name}"', [
                                    'name' => $path[1]
                                ])
                            );
                        }
                        return '';
                    }
                    $path .= rawurlencode($params[$part[1]]);
                    break;
                case 'optional':
                    $segment = $this->buildPath($part[1], $params, true);
                    if ($segment !== '') {
                        $path .= $segment;
                    }
                    break;
            }
        }
        return $path;
    }
1365684
private function buildPathFromSource(string $path) :string {
    //return $this->buildContext->getPath('build') . '/' .
    return str_replace('.', '/', str_replace($this->context . ".", '', $this->viewNameFromSource($path))) .
      $this->buildExtension;
  }
36322
public function toUri(array $pathVars = []): string
    {
        if ($pathVars) {
            return \strtr($this->path, $pathVars);
        }

        return $this->path;
    }
84197
protected function doGet(string $path, array $parameters = [], array $headers = [])
    {
        if (0 < \count($parameters)) {
            $path .= '?'.\http_build_query($parameters);
        }

        $request = $this
            ->getInstapushClient()
            ->getRequestFactory()
            ->createRequest('GET', $path, $headers);

        $this->setRequest($request);

        $response = $this
            ->getInstapushClient()
            ->getHttpClient()
            ->sendRequest($request);

        $this->setResponse($response);

        return $this;
    }
1002241
public function createUrl($path = '', $options = array())
    {

        $builtUrl = '';
        $hasHttp = stristr($path, 'http://') || stristr($path, 'https://');

        if (!empty($options['addServer']) && !$hasHttp) {
            $builtUrl .= $this->_server;
        }

        if (!stristr($path, self::URL_PREFIX) && !$hasHttp) {
            $builtUrl .= self::URL_PREFIX . '/' . self::API_VERSION;
        }

        $builtUrl .= $path;

        if (!empty($options['addMethod']) || !empty($options['addToken'])) {
            $builtUrl .= (stristr($path, '?') ? '&' : '?');
        }

        if (!empty($options['addMethod'])) {
            $builtUrl .= '_method=' . $options['addMethod'];
        }
        if (!empty($options['addToken'])) {
            $builtUrl .= ($options['addMethod'] ? '&' : '') . 'access_token=' . $this->_auth->accessToken();
        }

        return $builtUrl;

    }
735198
public function parse($path)
	{
		try
		{
			$data = SymfonyYaml::parse(file_get_contents($path));
		}
		catch (Exception $exception)
		{
			throw new ParseException(
				array(
					'message'   => 'Error parsing YAML',
					'exception' => $exception,
				)
			);
		}

		return $data;
	}
381105
protected function setServicesFile($path, $template, array $vars) {
    $this->addServicesFile()
      ->path($path)
      ->template($template)
      ->vars($vars);
  }
292400
protected function loadConfiguration($path)
    {
        try {
            $configuration = Yaml::parse(file_get_contents($path));
            if (!is_array($configuration)) {
                throw new ParseException('Invalid content.', 1);
            }

            return $configuration;
        } catch (ParseException $e) {
            $this->output->writeln(sprintf('<error>Unable to parse the YAML string: %s</error>', $e->getMessage()));

            return [];
        }
    }
427654
public VarSetBuilder varSetAtPath( String[] path)
    {
    VarSet varSet = null;
    if( path != null && path.length > 0)
      {
      varSet = new VarSet( path[0]);
      varSet_.addMember( varSet);

      for( int i = 1; i < path.length; i++)
        {
        VarSet child = new VarSet( path[i]);
        varSet.addMember( child);
        varSet = child;
        }
      }

    return
      varSet == null
      ? null
      : new VarSetBuilder( varSet);
    }
69237
protected function buildApiUrl(string $path, array $parameters): string
    {
        $parameters = array_merge([
            'access_token' => $this->accessToken,
        ], $parameters);

        $query = http_build_query($parameters, '', '&');

        return 'https://api.instagram.com/v1/'.$path.'?'.$query;
    }
801113
protected function loadTemplate( $path, array $vars = [] ) {
		try {
			return \Pressbooks\Utility\template( $path, $vars );
		} catch ( \Exception $e ) {
			if ( WP_DEBUG ) {
				return "File not found: {$path}";
			} else {
				return '';
			}
		}
	}
23093
public function compile(array $vars = [])
    {
        // start compilation
        if($this->compiling) {
            throw new \LogicException('Template is already compiling.');
        }
        $this->compiling = true;

        // extract user vars
        extract($vars);
        unset($vars);

        // start stream capture
        ob_start();

        // display file
        require $this->file;

        // stop stream capture
        $content = ob_get_clean();
        $content .= "\n\n";

        // compile layout
        if($this->layout) {
            list($layout, $vars) = $this->layout;
            $blocks = array_merge($this->blocks, ['__CONTENT__' => $content]);
            $content = $this->templater->render($layout, $vars, $blocks);
        }

        // end
        $this->compiling = false;
        return $content;
    }
1107418
protected function getNamespaceFromModuleJson($path)
    {
        $moduleProperties = $this->parseModuleJson($path);

        if (!isset($moduleProperties->module->namespace)) {
            throw new Exception('The namespace is not set in the module properties for the module in "' . $path . '".');
        }
        
        return Framework::prepareNamespace($moduleProperties->module->namespace);
    }