<commit_before><?php

namespace Presentation\Grids;


use Presentation\Framework\Component\Html\Div;
use Presentation\Framework\Component\Html\Form;
use Presentation\Framework\Component\Html\Tag;
use Presentation\Framework\Component\Repeater;
use Presentation\Grids\Component\TCell;
use Presentation\Grids\Component\Tr;
use Presentation\Grids\Layout\ControlPlacingStrategy\SolidRowStrategy;

class ConfigDefaults
{
    public function apply(GridConfig $config)
    {
        if (!$config->getForm()) {
            $config->setForm(new Form());
        }

        if (!$config->getContainer()) {
            $config->setContainer(new Div(['data-role'=> 'grid-container']));
        }

        if(!$config->getColumnRepeater()) {
            $config->setColumnRepeater(new Repeater());
        }

        if(!$config->getRowRepeater()) {
            $config->setRowRepeater(new Repeater());
        }

        if(!$config->getTRow()) {
            $config->setTRow(new Tr);
        }

        if (!$config->getTable()) {
            $config->setTable(new Tag('table'));
        }

        if (!$config->getTHead()) {
            $config->setTHead(new Tag('tHead'));
        }

        if (!$config->getTBody()) {
            $config->setTBody(new Tag('tbody'));
        }

        if (!$config->getTFoot()) {
            $config->setTFoot(new Tag('tfoot'));
        }

        if (!$config->getTCell()) {
            $config->setTCell(new TCell());
        }

        if (!$config->getControlPlacingStrategy()) {
            $config->setControlPlacingStrategy(new SolidRowStrategy());
        }

        if (!$config->getSubmitButton() && !$config->getControls()->isEmpty()) {
            $config->setSubmitButton(new Tag(
                'input',
                [
                    'type' => 'submit',
                    'data-role' => 'grid-submit'
                ]
            ));
        }
    }
}<commit_msg>ConfigDefaults: InputSource added<commit_after><?php

namespace Presentation\Grids;


use Presentation\Framework\Component\Html\Div;
use Presentation\Framework\Component\Html\Form;
use Presentation\Framework\Component\Html\Tag;
use Presentation\Framework\Component\Repeater;
use Presentation\Framework\Input\InputSource;
use Presentation\Grids\Component\TCell;
use Presentation\Grids\Component\Tr;
use Presentation\Grids\Layout\ControlPlacingStrategy\SolidRowStrategy;

class ConfigDefaults
{
    public function apply(GridConfig $config)
    {
        if (!$config->getForm()) {
            $config->setForm(new Form());
        }

        if (!$config->getContainer()) {
            $config->setContainer(new Div(['data-role'=> 'grid-container']));
        }

        if(!$config->getColumnRepeater()) {
            $config->setColumnRepeater(new Repeater());
        }

        if(!$config->getRowRepeater()) {
            $config->setRowRepeater(new Repeater());
        }

        if(!$config->getTRow()) {
            $config->setTRow(new Tr);
        }

        if (!$config->getTable()) {
            $config->setTable(new Tag('table'));
        }

        if (!$config->getTHead()) {
            $config->setTHead(new Tag('tHead'));
        }

        if (!$config->getTBody()) {
            $config->setTBody(new Tag('tbody'));
        }

        if (!$config->getTFoot()) {
            $config->setTFoot(new Tag('tfoot'));
        }

        if (!$config->getTCell()) {
            $config->setTCell(new TCell());
        }

        if (!$config->getControlPlacingStrategy()) {
            $config->setControlPlacingStrategy(new SolidRowStrategy());
        }

        if (!$config->getSubmitButton() && !$config->getControls()->isEmpty()) {
            $config->setSubmitButton(new Tag(
                'input',
                [
                    'type' => 'submit',
                    'data-role' => 'grid-submit'
                ]
            ));
        }

        if (!$config->getInputSource()) {
            $config->setInputSource(new InputSource($_GET));
        }
    }
}
{'fraction_non_alphanumeric': 0.16051844466600199, 'fraction_numerical': 0.0, 'mean_word_length': 2.0892994611239417, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, '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': '477058', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1136, 'n_words': 158}