<commit_before><?php
namespace Concrete\Core\Attribute;

use Core;
use Database;
use \Concrete\Core\Foundation\Object;
use \Concrete\Core\Attribute\Controller as AttributeTypeController;

class DefaultController extends AttributeTypeController
{

    protected $searchIndexFieldDefinition = array(
        'type' => 'string',
        'options' => array('default' => null, 'notnull' => false)
    );

    public function getValue()
    {
        $db = Database::get();
        $value = $db->GetOne("select value from atDefault where avID = ?", array($this->getAttributeValueID()));
        return $value;
    }

    public function form()
    {
        if (is_object($this->attributeValue)) {
            $value = Core::make('helper/text')->entities($this->getAttributeValue()->getValue());
        }
        print Core::make('helper/form')->textarea($this->field('value'), $value);
    }

    public function searchForm($list)
    {
        if ($this->request('value') === '') {
            return $list;
        }
        $list->filterByAttribute($this->attributeKey->getAttributeKeyHandle(), '%' . $this->request('value') . '%',
            'like');
        return $list;
    }

    public function getDisplaySanitizedValue()
    {
        return Core::make('helper/text')->entities($this->getValue());
    }

    public function search()
    {
        $f = Core::make('helper/form');
        print $f->text($this->field('value'), $this->request('value'));
    }

    // run when we call setAttribute(), instead of saving through the UI
    public function saveValue($value)
    {
        $db = Database::get();
        $db->Replace('atDefault', array('avID' => $this->getAttributeValueID(), 'value' => $value), 'avID', true);
    }

    public function saveForm($data)
    {
        $this->saveValue(isset($data['value']) ? $data['value'] : null);
    }

    public function deleteKey()
    {
        $db = Database::get();
        $arr = $this->attributeKey->getAttributeValueIDList();
        foreach ($arr as $id) {
            $db->Execute('delete from atDefault where avID = ?', array($id));
        }
    }

    public function validateValue()
    {
        return $this->getValue() != '';
    }

    public function validateForm($data)
    {
        return $data['value'] != '';
    }

    public function deleteValue()
    {
        $db = Database::get();
        $db->Execute('delete from atDefault where avID = ?', array($this->getAttributeValueID()));
    }

}<commit_msg>PSR<commit_after><?php

namespace Concrete\Core\Attribute;

use Core;
use Database;
use Concrete\Core\Attribute\Controller as AttributeTypeController;

class DefaultController extends AttributeTypeController
{
    protected $searchIndexFieldDefinition = array(
        'type' => 'string',
        'options' => array('default' => null, 'notnull' => false),
    );

    public function getValue()
    {
        $db = Database::get();
        $value = $db->GetOne("select value from atDefault where avID = ?", array($this->getAttributeValueID()));

        return $value;
    }

    public function form()
    {
        if (is_object($this->attributeValue)) {
            $value = Core::make('helper/text')->entities($this->getAttributeValue()->getValue());
        }
        print Core::make('helper/form')->textarea($this->field('value'), $value);
    }

    public function searchForm($list)
    {
        if ($this->request('value') === '') {
            return $list;
        }
        $list->filterByAttribute($this->attributeKey->getAttributeKeyHandle(), '%' . $this->request('value') . '%',
            'like');

        return $list;
    }

    public function getDisplaySanitizedValue()
    {
        return Core::make('helper/text')->entities($this->getValue());
    }

    public function search()
    {
        $f = Core::make('helper/form');
        print $f->text($this->field('value'), $this->request('value'));
    }

    // run when we call setAttribute(), instead of saving through the UI
    public function saveValue($value)
    {
        $db = Database::get();
        $db->Replace('atDefault', array('avID' => $this->getAttributeValueID(), 'value' => $value), 'avID', true);
    }

    public function saveForm($data)
    {
        $this->saveValue(isset($data['value']) ? $data['value'] : null);
    }

    public function deleteKey()
    {
        $db = Database::get();
        $arr = $this->attributeKey->getAttributeValueIDList();
        foreach ($arr as $id) {
            $db->Execute('delete from atDefault where avID = ?', array($id));
        }
    }

    public function validateValue()
    {
        return $this->getValue() != '';
    }

    public function validateForm($data)
    {
        return $data['value'] != '';
    }

    public function deleteValue()
    {
        $db = Database::get();
        $db->Execute('delete from atDefault where avID = ?', array($this->getAttributeValueID()));
    }
}
{'fraction_non_alphanumeric': 0.17076142131979696, 'fraction_numerical': 0.0, 'mean_word_length': 2.700976709241172, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 69, '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': '4146251', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1371, 'n_words': 286}