<commit_before><?php

namespace SleepingOwl\Admin\Display\Column;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use SleepingOwl\Admin\Contracts\Display\ControlButtonInterface;
use SleepingOwl\Admin\Display\ControlButton;
use SleepingOwl\Admin\Display\ControlLink;
use SleepingOwl\Admin\Display\TableColumn;

class Control extends TableColumn
{
    /**
     * @var string
     */
    protected $view = 'column.control';

    /**
     * @var string
     */
    protected $width = '90px';

    /**
     * @var Collection
     */
    protected $buttons;

    /**
     * @var bool
     */
    protected $editable = true;

    /**
     * @var bool
     */
    protected $deletable = true;

    /**
     * @var bool
     */
    protected $destroyable = true;

    /**
     * @var bool
     */
    protected $restorable = true;

    /**
     * Control constructor.
     *
     * @param string|null $label
     */
    public function __construct($label = null)
    {
        parent::__construct($label);

        $this->buttons = new Collection();

        $this->setHtmlAttribute('class', 'text-right');
    }

    public function initialize()
    {
        parent::initialize();

        $this->buttons->put('edit', $button = new ControlLink(function (Model $model) {
            return $this->getModelConfiguration()->getEditUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.edit'), 100));
        $button->hideText();
        $button->setCondition(function () {
            return $this->isEditable();
        });
        $button->setIcon('fa fa-pencil');
        $button->setHtmlAttribute('class', 'btn-primary');

        $this->buttons->put('delete', $button = new ControlButton(function (Model $model) {
            return $this->getModelConfiguration()->getDeleteUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.delete'), 200));
        $button->setCondition(function () {
            return $this->isDeletable();
        });

        $button->setMethod('delete');
        $button->hideText();
        $button->setIcon('fa fa-trash');
        $button->setHtmlAttribute('class', 'btn-danger btn-delete');

        $this->buttons->put('destroy', $button = new ControlButton(function (Model $model) {
            return $this->getModelConfiguration()->getDestroyUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.destroy'), 300));
        $button->setCondition(function () {
            return $this->isDestroyable();
        });

        $button->setMethod('delete');
        $button->hideText();
        $button->setIcon('fa fa-trash');
        $button->setHtmlAttribute('class', 'btn-danger btn-destroy');

        $this->buttons->put('restore', $button = new ControlButton(function (Model $model) {
            return $this->getModelConfiguration()->getRestoreUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.restore'), 400));
        $button->setCondition(function () {
            return $this->isRestorable();
        });
        $button->hideText();
        $button->setIcon('fa fa-reply');
        $button->setHtmlAttribute('class', 'btn-warning');
    }

    /**
     * @param ControlButtonInterface $button
     *
     * @return $this
     */
    public function addButton(ControlButtonInterface $button)
    {
        $this->buttons->push($button);

        return $this;
    }

    /**
     * @param $editable
     * @return $this
     */
    protected function setEditable($editable)
    {<commit_msg>Fix protected to public setEditable<commit_after><?php

namespace SleepingOwl\Admin\Display\Column;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use SleepingOwl\Admin\Contracts\Display\ControlButtonInterface;
use SleepingOwl\Admin\Display\ControlButton;
use SleepingOwl\Admin\Display\ControlLink;
use SleepingOwl\Admin\Display\TableColumn;

class Control extends TableColumn
{
    /**
     * @var string
     */
    protected $view = 'column.control';

    /**
     * @var string
     */
    protected $width = '90px';

    /**
     * @var Collection
     */
    protected $buttons;

    /**
     * @var bool
     */
    protected $editable = true;

    /**
     * @var bool
     */
    protected $deletable = true;

    /**
     * @var bool
     */
    protected $destroyable = true;

    /**
     * @var bool
     */
    protected $restorable = true;

    /**
     * Control constructor.
     *
     * @param string|null $label
     */
    public function __construct($label = null)
    {
        parent::__construct($label);

        $this->buttons = new Collection();

        $this->setHtmlAttribute('class', 'text-right');
    }

    public function initialize()
    {
        parent::initialize();

        $this->buttons->put('edit', $button = new ControlLink(function (Model $model) {
            return $this->getModelConfiguration()->getEditUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.edit'), 100));
        $button->hideText();
        $button->setCondition(function () {
            return $this->isEditable();
        });
        $button->setIcon('fa fa-pencil');
        $button->setHtmlAttribute('class', 'btn-primary');

        $this->buttons->put('delete', $button = new ControlButton(function (Model $model) {
            return $this->getModelConfiguration()->getDeleteUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.delete'), 200));
        $button->setCondition(function () {
            return $this->isDeletable();
        });

        $button->setMethod('delete');
        $button->hideText();
        $button->setIcon('fa fa-trash');
        $button->setHtmlAttribute('class', 'btn-danger btn-delete');

        $this->buttons->put('destroy', $button = new ControlButton(function (Model $model) {
            return $this->getModelConfiguration()->getDestroyUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.destroy'), 300));
        $button->setCondition(function () {
            return $this->isDestroyable();
        });

        $button->setMethod('delete');
        $button->hideText();
        $button->setIcon('fa fa-trash');
        $button->setHtmlAttribute('class', 'btn-danger btn-destroy');

        $this->buttons->put('restore', $button = new ControlButton(function (Model $model) {
            return $this->getModelConfiguration()->getRestoreUrl($model->getKey());
        }, trans('sleeping_owl::lang.table.restore'), 400));
        $button->setCondition(function () {
            return $this->isRestorable();
        });
        $button->hideText();
        $button->setIcon('fa fa-reply');
        $button->setHtmlAttribute('class', 'btn-warning');
    }

    /**
     * @param ControlButtonInterface $button
     *
     * @return $this
     */
    public function addButton(ControlButtonInterface $button)
    {
        $this->buttons->push($button);

        return $this;
    }

    /**
     * @param $editable
     * @return $this
     */
    public function setEditable($editable)
    {
{'fraction_non_alphanumeric': 0.1629461111901038, 'fraction_numerical': 0.003981231337978103, 'mean_word_length': 2.536450477626948, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 95, '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': '1759492', 'n_tokens_mistral': 2029, 'n_tokens_neox': 1970, 'n_words': 338}