Parses the templates folder and returns the retrieved information
as array

@return array
340643
public function parse()
    {
        $templates = array();
        $finder = new Finder(); 
        
        $directories = array(
            $this->templatesDir, 
        );
        
        $globalResourcesFolder = $this->kernelDir . '/Resources/views/' . $this->themeName;
        if (is_dir($globalResourcesFolder)) {
            $directories[] = $globalResourcesFolder;
        }
        
        $templateFiles = $finder->files('*.twig')->in($directories);
        foreach ($templateFiles as $template) {
            $template = (string)$template;
            $templateName = basename($template);
            $templateContents = file_get_contents($template);
            
            $slots = $this->fetchSlots($templateContents);
            if (empty($slots)) {
                continue;
            }
            
            $templates[$templateName]['assets']['external_stylesheets'] = $this->fetchExternalStylesheets($templateContents);
            $templates[$templateName]['assets']['external_javascripts'] = $this->fetchExternalJavascripts($templateContents);
            $templates[$templateName]['assets']['external_stylesheets_cms'] = $this->fetchExternalStylesheetsCms($templateContents);
            $templates[$templateName]['assets']['external_javascripts_cms'] = $this->fetchExternalJavascriptsCms($templateContents);
            $templates[$templateName]['slots'] = $slots;
            if (strpos($template, $this->kernelDir) === false) {
                $templates[$templateName]['generate_template'] = dirname($template) == $this->templatesDir;
            }
        }
        
        return $templates;
    }
767170
protected function getPageTemplates()
    {
        $choices = [];

        $templates = $this->getContainer()->getParameter('networking_init_cms.page.templates');
        foreach ($templates as $key => $template) {
            $choices[$template['name']] = $key;
        }

        return $choices;
    }
1340084
private function parse()
    {
        if (isset($this->template, $this->frontMatter)) {
            return $this;
        }

        $source = $this->readSourceFile();

        $parts = preg_split('/[\n]*[-]{3}[\n]/', $source, 2);
        if (count($parts) === 2) {
            $this->frontMatter = Yaml::parse($parts[0]);
            $this->template = trim($parts[1]);
        } else {
            $this->frontMatter = array();
            $this->template = trim($source);
        }

        return $this;
    }
186900
public function getNotificationTemplateData()
    {
        $fields = $this->Context->getValues();
        if (!is_array($fields)) {
            $fields = [];
        }
        $fields['Content'] = $this->Content;
        return $fields;
    }
927632
public static function getList(): array
    {
        $result = [];
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Types';
        $dir = new Folder($path);

        $files = $dir->find('.*\.php');

        if (empty($files)) {
            return $result;
        }

        foreach ($files as $file) {
            $name = str_replace('.php', '', $file);
            $value = Inflector::underscore($name);
            $result[$value] = $name;
        }

        return $result;
    }
1074498
function toArray()
    {
        $parse = array(
            'scheme'    => $this->getScheme(),
            'user_info' => $this->getUserInfo(),
            'host'      => $this->getHost(),
            'port'      => $this->getPort(),
            'path'      => $this->getPath(),
            'query'     => $this->getQuery()->toString(),
            'fragment'  => $this->getFragment(),
            
            'authority' => $this->getAuthority(),
        );

        return $parse;
    }
535583
public static function get_top_level_templates()
	{

		$ss_templates_array = array();
		$current_theme_path = THEMES_PATH.'/'.Config::inst()->get('SSViewer', 'theme');

		//theme directories to search
		$search_dir_array = array(
			MAINTENANCE_MODE_PATH.'/templates',
			$current_theme_path.'/templates'
		);

		foreach ($search_dir_array as $directory) {

			//Get all the SS templates in the directory
			foreach (glob("{$directory}/*.ss") as $template_path) {

				//get the template name from the path excluding the ".ss" extension
				$template = basename($template_path, '.ss');

				//Add the key=>value pair to the ss_template_array
				$ss_templates_array[$template] = $template;
			}

		}

		return $ss_templates_array;

	}
645942
public function getList(): array {
        $list = array();
        $dir = $this->_docRoot . $this->_path;
        if (is_dir($dir)) {
            if ($dh = opendir($dir)) {
                while (($file = readdir($dh)) !== false) {
                    if (substr($file, 0, 1) !== '.'
                        && strpos($file, '.') !== false
                    ) {
                        $list[] = $file;
                    }
                }
                closedir($dh);
            }
        } else {
            throw new Exception($dir . ' is not a directory.');
        }

        return $list;
    }
896379
public function getTemplates()
    {
        $templates = SSViewer::get_templates_by_class($this, '', __CLASS__);
        // Prefer any custom template
        if ($this->getTemplate()) {
            array_unshift($templates, $this->getTemplate());
        }
        return $templates;
    }
1035361
public function parse()
    {
        $matched = [];
        foreach ($this->_routers as $router) {
            if ($router->isMatched($this->getPathInfo(), count($matched))) {
                if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) {
                    $this->getLogger()->debug(sprintf('router %s is matched', get_class($router)));
                }

                $matched[] = $router;
                if ($router->isContinue() === false) {
                    break;
                }
            }
        }

        return $matched;
    }
483725
public function toArray()
    {
        return [
            'name' => $this->name,
            'description' => $this->description,
            'author' => $this->author,
            'enabled' => $this->enabled,
            'path' => $this->path,
            'files' => $this->files,
        ];
    }
853710
private function getTemplates()
	{
		if (is_null($this->templates))
		{
			useLib('templates');
			$this->templates = new Templates();
		}

		return $this->templates;
	}
1090920
public function parse() : array
    {
        $buffer = $this->routing_rule;
        
        $section_list_set = [];
        $current_list = [];
        do
        {
            $pos = strpos(substr($buffer,1),'/');
            $section = $pos !== false ? substr($buffer, 1, $pos) : substr($buffer, 1);
            $buffer = $pos !== false ? substr($buffer, $pos + 1) : '';
            
            $length = strlen($section);
            if ($length === 0){
                $current_list[] = new class implements EmptyRoutingPathInterface {};
                if (!empty($buffer)){
                    throw new RoutingRuleParseException($this->routing_rule, "Empty routing section is allowed only for last element");
                }
                break;
            }
            $first = $section[0];
            $last = $section[$length - 1];
            if ($first === '[' && $last === ']'){
                // push current list
                $section_list_set[] = $current_list + ['()'];
                // add optional part to current list
                $inside = substr($section, 1, $length - 2);
                if ($inside[0] === ':') {
                    $current_list[] = self::parseVariablePattern($inside);
                }
                else {
                    $current_list[] = $inside;
                }
            }
            else if ($first === ':') {
                $current_list[] = self::parseVariablePattern($section);
            }
            else {
                $current_list[] = $section;
            }
        }
        while(!empty($buffer));
        
        $section_list_set[] = $current_list;
        return $section_list_set;
    }
255078
protected function getDeltasFilesArray()
    {
        $files = [];

        $baseDir = realpath($this->dir);
        $dh = opendir($baseDir);

        if ($dh === false) {
            return $files;
        }

        $fileChangeNumberPrefix = '';
        while (($file = readdir($dh)) !== false) {
            if (preg_match('[\d+]', $file, $fileChangeNumberPrefix)) {
                $files[(int) $fileChangeNumberPrefix[0]] = $file;
            }
        }

        return $files;
    }
679886
public function getArray()
    {
        $contents = [];

        foreach (new DirectoryIterator($this->context) as $file) {
            if ($file->isDot()) {
                continue;
            }

            $className = $file->isDir() ? 'Directory' : ucfirst(strtolower($file->getExtension()));
            $classPath = 'PHLAK\\Config\\Loaders\\' . $className;

            $loader = new $classPath($file->getPathname());

            try {
                $contents = array_merge($contents, $loader->getArray());
            } catch (InvalidFileException $e) {
                // Ignore it and continue
            }
        }

        return $contents;
    }
590702
protected function loadTemplates()
	{
		$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates');
		$this->twigEnv = new Twig_Environment($loader, ['cache' => false, 'debug' => true]);
		$this->twigEnv->addExtension(new Twig_Extension_Debug());

		// Custom filter for phpdoc
		$filter = new \Twig_Filter('phpdoc', function($string, $indentationCount = 0, $indentChar = "\t") {
			$result = str_repeat($indentChar, $indentationCount) . '/**' . "\n";
			// Split per line
			$lines = explode("\n", trim($string));
			foreach ($lines as $line) {
				$result .= str_repeat($indentChar, $indentationCount) . ' * ' . $line . "\n";
			}
			$result .= str_repeat($indentChar, $indentationCount) . ' */' . "\n";
			return $result;
		});

		$this->twigEnv->addFilter($filter);

		$this->managerTemplate = $this->twigEnv->load('manager.php.twig');
		$this->resourceTemplate = $this->twigEnv->load('resource.php.twig');
		$this->mainClientTemplate = $this->twigEnv->load('mainClient.php.twig');
		$this->mainExceptionTemplate = $this->twigEnv->load('mainException.php.twig');
		$this->unexpectedResponseExceptionTemplate = $this->twigEnv->load('unexpectedResponseException.php.twig');

		if (!is_null($this->testsOutputPath)) {
			$this->mainClientTestTemplate = $this->twigEnv->load('mainClientTest.php.twig');
			$this->managerTestTemplate = $this->twigEnv->load('managerTest.php.twig');
		}
	}
969423
public function parse()
    {
        try {
            $this->ensureFileIsReadable();
        } catch (InvalidPathException $e) {
            return [];
        }

        $filePath = $this->filePath;
        $lines = $this->readLinesFromFile($filePath);

        $data = [];
        foreach ($lines as $line) {
            if (!$this->isComment($line) && $this->looksLikeSetter($line)) {
                list($name, $value) = $this->processFilters($line, null);
                $data[$name] = $value;
            }
        }

        return $data;
    }