<commit_before><?php
/**
 * This file is part of the PHPLucidFrame library.
 * SchemaManager manages your database schema.
 *
 * @package     PHPLucidFrame\Core
 * @since       PHPLucidFrame v 3.0.0
 * @copyright   Copyright (c), PHPLucidFrame.
 * @author      <NAME>. <<EMAIL>>
 * @link        http://phplucidframe.com
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE
 */

namespace LucidFrame\Core;

class View
{
    /**
     * @var string Layout file name
     */
    private $layout = 'layout';
    /**
     * @var string View name to append to the file name such as view_{$name}.php
     */
    private $name;
    /**
     * @var array Array of data passed into view
     */
    private $data = array();

    /**
     * Setter
     *
     * @param string $name The property name
     * @param mixed $value The property value
     */
    public function __set($name, $value)
    {
        $this->$name = $value;
    }

    /**
     * Getter
     *
     * @param string $name The property name
     * @return mixed
     */
    public function __get($name)
    {
        return $this->$name;
    }

    /**
     * Add data into view
     *
     * @param string $key The variable name to be accessible in view
     * @param mixed $value The value of the variable
     */

    public function addData($key, $value)
    {
        $this->data[$key] = $value;
    }

    /**
     * Display view
     *
     * @param string $name Optional view name to append to the file name such as view_{$name}.php
     * @return void
     */
    public function load($name = '')
    {
        $name = $name ?: $this->name;

        if ($name) {
            $viewName = 'view_' . $name;
        } else {
            $viewName = 'view';
        }

        $view = _i(_ds(_cr(), $viewName . '.php'));
        if ($view) {
            extract($this->data);
            include $view;
        } else {
            throw new \RuntimeException('View file is missing.');
        }
    }
}<commit_msg>Ability to include block view<commit_after><?php
/**
 * This file is part of the PHPLucidFrame library.
 * SchemaManager manages your database schema.
 *
 * @package     PHPLucidFrame\Core
 * @since       PHPLucidFrame v 3.0.0
 * @copyright   Copyright (c), PHPLucidFrame.
 * @author      <NAME>. <<EMAIL>>
 * @link        http://phplucidframe.com
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE
 */

namespace LucidFrame\Core;

class View
{
    /**
     * @var string Layout file name
     */
    private $layout = 'layout';
    /**
     * @var string View name to append to the file name such as view_{$name}.php
     */
    private $name;
    /**
     * @var array Array of data passed into view
     */
    private $data = array();

    /**
     * Setter
     *
     * @param string $name The property name
     * @param mixed $value The property value
     */
    public function __set($name, $value)
    {
        $this->$name = $value;
    }

    /**
     * Getter
     *
     * @param string $name The property name
     * @return mixed
     */
    public function __get($name)
    {
        return $this->$name;
    }

    /**
     * Add data into view
     *
     * @param string $key The variable name to be accessible in view
     * @param mixed $value The value of the variable
     */

    public function addData($key, $value)
    {
        $this->data[$key] = $value;
    }

    /**
     * Display view
     *
     * @param string $name Optional view name to append to the file name such as view_{$name}.php
     * @return void
     */
    public function load($name = '')
    {
        $name = $name ?: $this->name;

        if ($name) {
            $viewName = 'view_' . $name;
        } else {
            $viewName = 'view';
        }

        $view = _i(_ds(_cr(), $viewName . '.php'));
        if ($view) {
            extract($this->data);
            include $view;
        } else {
            throw new \RuntimeException('View file is missing.');
        }
    }

    /**
     * Display block view
     *
     * @param string $name Block view name to the file name such as block_{$name}.php
     * @param array $data
     */
    public function block($name, array $data = array())
    {
        $blockName = 'block_' . $name;
        $this->data = array_merge($this->data, $data);

        $block = _i(_ds(_cr(), $blockName . '.php'));
        if ($block) {
            extract($this->data);
            include $block;
        } else {
            throw new \RuntimeException('Block view file is missing.');
        }
    }
}
{'fraction_non_alphanumeric': 0.12702702702702703, 'fraction_numerical': 0.0012474012474012475, 'mean_word_length': 1.8484310242747188, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1315901', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1409, 'n_words': 456}