<commit_before><?php 
/**
 * DframeFramework
 * Copyright (c) <NAME>
 *
 * @license https://github.com/dframe/dframe/blob/master/LICENCE (MIT)
 */

namespace Dframe\View;

use Dframe\Config;

/**
 * Short Description
 *
 * @author <NAME> <<EMAIL>>
 */
class DefaultView implements \Dframe\View\ViewInterface
{
    
    public function __construct()
    {
        $this->templateConfig = Config::load('view/defaultConfig');
    }

    /**
     * Set the var to the template
     *
     * @param string $name 
     * @param string $value
     *
     * @return void
     */
    public function assign($name, $value)
    {
        $this->$name = $value;
    }

    /**
     * Return code
     *
     * @param string $name Filename
     * @param string $path Alternative Path
     *
     * @return void
     */
    public function fetch($name, $path = null)
    {
        throw new \Exception('This module dont have fetch');
    }

    /**
     * Przekazuje kod do szablonu Smarty
     *
     * @param string $name
     * @param string $path
     *
     * @return void
     */
    public function renderInclude($name)
    {

        $pathFile = pathFile($name);
        $folder = $pathFile[0];
        $name = $pathFile[1];<commit_msg>Changing default View<commit_after><?php 
/**
 * DframeFramework
 * Copyright (c) <NAME>
 *
 * @license https://github.com/dframe/dframe/blob/master/LICENCE (MIT)
 */

namespace Dframe\View;

use Dframe\Config;

/**
 * Short Description
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class DefaultView implements \Dframe\View\ViewInterface
{
    
    public function __construct()
    {
        $this->templateConfig = Config::load('view/default');
    }

    /**
     * Set the var to the template
     *
     * @param string $name 
     * @param string $value
     *
     * @return void
     */
    public function assign($name, $value)
    {
        $this->$name = $value;
    }

    /**
     * Return code
     *
     * @param string $name Filename
     * @param string $path Alternative Path
     *
     * @return void
     */
    public function fetch($name, $path = null)
    {
        $pathFile = pathFile($name);
        $folder = $pathFile[0];
        $name = $pathFile[1];

        if ($path == null) {
            $path = $this->templateConfig->get('setTemplateDir').'/'.$folder.$name.$this->templateConfig->get('fileExtension', '.html.php');
        }
        
        try{
            if (!is_file($path)) {
                throw new \Exception('Can not open template '.$name.' in: '.$path);
            }
            ob_start();
            include($path);          

        }catch(Exception $e) {
            echo $e->getMessage().'<br />
                File: '.$e->getFile().'<br />
                Code line: '.$e->getLine().'<br />
                Trace: '.$e->getTraceAsString();
            exit();
        }
        
        return ob_get_clean();
    }

    /**
     * Przekazuje kod do szablonu Smarty
     *
     * @param string $name
     * @param string $path
     *
     * @return void
     */
    public function renderInclude($name, $path = null)
    {

        $pathFile = pathFile($name);
        $folder = $pathFile[0];
        $name = $pathFile[1];
{'fraction_non_alphanumeric': 0.15046439628482972, 'fraction_numerical': 0.0018575851393188853, 'mean_word_length': 1.8669032830523513, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3481885', 'n_tokens_mistral': 1008, 'n_tokens_neox': 994, 'n_words': 225}