<commit_before><?php
/**
 *
 */

namespace Arc5\Facade;

use Mvc5\Arg;
use Mvc5\Model\Template;
use Mvc5\Model\ViewModel;
use Mvc5\Model\ViewLayout;
use Mvc5\Service\Facade;

trait View
{
    /**
     *
     */
    use Facade;

    /**
     * @param array $vars
     * @param null|string $template
     * @param string $model
     * @return Template|ViewModel|ViewLayout
     */
    static function model(array $vars = [], $template = null, $model = Arg::VIEW_MODEL)
    {
        $model = static::plugin($model);

        $template && $model->template($template);

        $vars && $model->vars($vars);

        return $model;
    }

    /**
     * @param array $vars
     * @param string $template
     * @param string $model
     * @return ViewLayout
     */
    static function layout(array $vars = [], $template = null, $model = 'layout')
    {
        return static::model($vars, $template, $model);
    }

    /**
     * @param mixed|string $template
     * @param array $vars
     * @return string<commit_msg>pass template vars to constructor<commit_after><?php
/**
 *
 */

namespace Arc5\Facade;

use Mvc5\Arg;
use Mvc5\Model\Template;
use Mvc5\Model\ViewModel;
use Mvc5\Model\ViewLayout;
use Mvc5\Service\Facade;

trait View
{
    /**
     *
     */
    use Facade;

    /**
     * @param array $vars
     * @param string $template
     * @param string $model
     * @return ViewLayout
     */
    static function layout(array $vars = [], $template = null, $model = Arg::LAYOUT)
    {
        return static::model($vars, $template, $model);
    }

    /**
     * @param array $vars
     * @param null|string $template
     * @param string $model
     * @return Template|ViewModel|ViewLayout
     */
    static function model(array $vars = [], $template = null, $model = Arg::VIEW_MODEL)
    {
        $template &&
            $vars[Arg::TEMPLATE_MODEL] = $template;

        return static::plugin($model, [$vars]);
    }

    /**
     * @param mixed|string $template
     * @param array $vars
     * @return string
{'fraction_non_alphanumeric': 0.14772727272727273, 'fraction_numerical': 0.005928853754940711, 'mean_word_length': 2.375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1160018', 'n_tokens_mistral': 654, 'n_tokens_neox': 642, 'n_words': 151}