<commit_before><?php
namespace Tuum\Form;

use Tuum\Form\Data\Data;
use Tuum\Form\Data\Errors;
use Tuum\Form\Data\Escape;
use Tuum\Form\Data\Inputs;
use Tuum\Form\Data\Message;

/**
 * Class Value
 *
 * @package Tuum\View\DataView
 *
 */
class DataView
{
    /**
     * @var Forms
     */
    public $forms;

    /**
     * @var Dates
     */
    public $dates;
    
    /**
     * @var Data
     */
    public $data;

    /**
     * @var Message
     */
    public $message;

    /**
     * @var Inputs
     */
    public $inputs;

    /**
     * @var Errors
     */
    public $errors;

    /**
     * @var callable|Escape
     */
    public $escape;

    /**
     * @param null|callable $escape
     */
    public function __construct($escape = null)
    {
        if (is_callable($escape)) {
            $this->escape = $escape;
        } else {
            $this->escape = new Escape();
        }
        $this->forms = new Forms();
        $this->dates = new Dates();
    }

    /**
     * @param Inputs $inputs
     */
    protected function setInputs($inputs)
    {
        if($this->forms) {
            $this->forms = $this->forms->withInputs($inputs);
        }
        if($this->dates) {
            $this->dates = $this->dates->withInputs($inputs);
        }
    }
}<commit_msg>add a minimum api for setting up the DataView.<commit_after><?php
namespace Tuum\Form;

use Tuum\Form\Data\Data;
use Tuum\Form\Data\Errors;
use Tuum\Form\Data\Escape;
use Tuum\Form\Data\Inputs;
use Tuum\Form\Data\Message;

/**
 * Class Value
 *
 * @package Tuum\View\DataView
 *
 */
class DataView
{
    /**
     * @var Forms
     */
    public $forms;

    /**
     * @var Dates
     */
    public $dates;
    
    /**
     * @var Data
     */
    public $data;

    /**
     * @var Message
     */
    public $message;

    /**
     * @var Inputs
     */
    public $inputs;

    /**
     * @var Errors
     */
    public $errors;

    /**
     * @var callable|Escape
     */
    public $escape;

    /**
     * @param null|callable $escape
     */
    public function __construct($escape = null)
    {
        if (is_callable($escape)) {
            $this->escape = $escape;
        } else {
            $this->escape = new Escape();
        }
        $this->forms = new Forms();
        $this->dates = new Dates();
    }

    /**
     * @param Inputs $inputs
     * @return $this
     */
    public function setInputs($inputs)
    {
        if($this->forms) {
            $this->forms = $this->forms->withInputs($inputs);
        }
        if($this->dates) {
            $this->dates = $this->dates->withInputs($inputs);
        }
        $this->inputs = $inputs;
        return $this;
    }

    /**
     * @param array|Data $data
     * @return $this
     */
    public function setData($data)
    {
        if(is_array($data)) {
            $this->data = new Data($data, $this->escape);
        }
        elseif($data instanceof Data) {
            $this->data = $data;
        }
        return $this;
    }

    /**
     * @param array|Message $messages
     * @return $this
     */
    public function setMessage($messages)
    {
        if(is_array($messages)) {
            $this->message = Message::forge($messages);
        }
        elseif($messages instanceof Message) {
            $this->message = $messages;
        }
        return $this;
    }

    /**
     * @param array|Errors $errors
     * @return $this
     */
    public function setErrors($errors)
    {
        if(is_array($errors)) {
            $this->errors = Errors::forge($errors);
        }
        elseif($errors instanceof Errors) {
            $this->errors = $errors;
        }
        return $this;
    }
}
{'fraction_non_alphanumeric': 0.15541090317331163, 'fraction_numerical': 0.0, 'mean_word_length': 1.5736217725052337, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '3551457', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1177, 'n_words': 230}