<commit_before><?php
namespace Presentation\Framework\Component\ManagedList;

use Presentation\Framework\Component\CompoundComponent;
use Presentation\Framework\Component\ManagedList\Control\ControlInterface;
use Presentation\Framework\Base\ComponentInterface;
use Presentation\Framework\Data\ArrayDataProvider;
use Presentation\Framework\Data\DataProviderInterface;
use Traversable;

/**
 * Class ManagedList
 *
 * ManagedList is a component for rendering data lists with interactive controls.
 */
class ManagedList extends CompoundComponent
{

    protected $isOperationsApplied = false;

    /**
     * @var array|null|DataProviderInterface|Traversable
     */
    protected $dataSource;

    protected function getDefaultStructure()
    {
        return [
            'form' => [
                'submit_button'
            ],
            'container' => [
                'repeater' => [
                    'record_view' => []
                ]
            ]
        ];
    }

    /**
     * @param array|null|DataProviderInterface|Traversable $dataSource
     */
    public function setDataSource($dataSource)
    {
        if (!$dataSource instanceof DataProviderInterface && (is_array($dataSource) || $dataSource instanceof Traversable)) {
            $dataSource = new ArrayDataProvider($dataSource);
        }
        $this->dataSource = $dataSource;
    }

    protected function buildTree()
    {
        if ($this->dataSource !== null) {
            $this->components()->getRepeater()->setIterator($this->dataSource);
        }
        return parent::buildTree();
    }

    /**
     * @param array|Traversable|DataProviderInterface|null $dataSrc
     * @param ComponentInterface|null $recordView
     * @param ControlInterface[]|null $controls
     */
    public function __construct(
        $dataSrc = null,
        ComponentInterface $recordView = null,
        $controls = null
    )
    {
        parent::__construct(
            $this->getDefaultStructure()
        );
        $this->setDataSource($dataSrc);
        if ($recordView) {<commit_msg>ManagedList refactoring<commit_after><?php
namespace Presentation\Framework\Component\ManagedList;

use Presentation\Framework\Component\CompoundComponent;
use Presentation\Framework\Component\ManagedList\Control\ControlInterface;
use Presentation\Framework\Base\ComponentInterface;
use Presentation\Framework\Data\ArrayDataProvider;
use Presentation\Framework\Data\DataProviderInterface;
use Traversable;

/**
 * Class ManagedList
 *
 * ManagedList is a component for rendering data lists with interactive controls.
 */
class ManagedList extends CompoundComponent
{

    protected $isOperationsApplied = false;

    /**
     * @var array|null|DataProviderInterface|Traversable
     */
    protected $dataSource;

    protected function getDefaultTreeConfig()
    {
        return [
            'form' => [
                'submit_button'
            ],
            'container' => [
                'repeater' => [
                    'record_view' => []
                ]
            ]
        ];
    }

    /**
     * @param array|null|DataProviderInterface|Traversable $dataSource
     */
    public function setDataSource($dataSource)
    {
        if (!$dataSource instanceof DataProviderInterface && (is_array($dataSource) || $dataSource instanceof Traversable)) {
            $dataSource = new ArrayDataProvider($dataSource);
        }
        $this->dataSource = $dataSource;
    }

    protected function buildTree()
    {
        if ($this->dataSource !== null) {
            $this->components()->getRepeater()->setIterator($this->dataSource);
        }
        return parent::buildTree();
    }

    /**
     * @param array|Traversable|DataProviderInterface|null $dataSrc
     * @param ComponentInterface|null $recordView
     * @param ControlInterface[]|null $controls
     */
    public function __construct(
        $dataSrc = null,
        ComponentInterface $recordView = null,
        $controls = null
    )
    {
        parent::__construct(
            $this->getDefaultTreeConfig()
        );
        $this->setDataSource($dataSrc);
        if ($recordView) {
{'fraction_non_alphanumeric': 0.10805595754944525, 'fraction_numerical': 0.0, 'mean_word_length': 2.5627147766323026, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '1447056', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1056, 'n_words': 201}