<commit_before><?php

/**
 * FAQ model
 *
 * @package     Nails
 * @subpackage  module-faq
 * @category    Model
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Faq\Model;

use Nails\Common\Model\Base;
use Nails\Factory;

class Faq extends Base
{
    /**
     * Faq constructor.
     */
    public function __construct()
    {
        parent::__construct();
        $this->table              = NAILS_DB_PREFIX . 'faq';
        $this->searchableFields[] = 'body';
    }

    // --------------------------------------------------------------------------

    /**
     * Describes the fields for this model
     *
     * @return array
     */
    public function describeFields()
    {
        $aData = parent::describeFields();

        $aData['label']->validation[] = 'required';
        $aData['body']->validation[]  = 'required';
        $aData['body']->type          = 'wysiwyg';

        return $aData;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns an array of the groups used in the FAQs
     * @return array
     */
    public function getGroups()
    {
        $oDb = Factory::service('Database');
        $oDb->select('DISTINCT(`group`) `group`');
        $aGroups = $oDb->get($this->table)->result();
        $aOut    = ['No Group'];

        foreach ($aGroups as $group) {
            $aOut[] = $group->group ? $group->group : 'No Group';
        }

        return array_unique($aOut);
    }
}<commit_msg>Making describeFields compatible with the base<commit_after><?php

/**
 * FAQ model
 *
 * @package     Nails
 * @subpackage  module-faq
 * @category    Model
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Faq\Model;

use Nails\Common\Model\Base;
use Nails\Factory;

class Faq extends Base
{
    /**
     * Faq constructor.
     */
    public function __construct()
    {
        parent::__construct();
        $this->table              = NAILS_DB_PREFIX . 'faq';
        $this->searchableFields[] = 'body';
    }

    // --------------------------------------------------------------------------

    /**
     * Describes the fields for this model
     *
     * @param  string $sTable The database table to query
     *
     * @return array
     */
    public function describeFields($sTable = null)
    {
        $aData = parent::describeFields($sTable);

        $aData['label']->validation[] = 'required';
        $aData['body']->validation[]  = 'required';
        $aData['body']->type          = 'wysiwyg';

        return $aData;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns an array of the groups used in the FAQs
     * @return array
     */
    public function getGroups()
    {
        $oDb = Factory::service('Database');
        $oDb->select('DISTINCT(`group`) `group`');
        $aGroups = $oDb->get($this->table)->result();
        $aOut    = ['No Group'];

        foreach ($aGroups as $group) {
            $aOut[] = $group->group ? $group->group : 'No Group';
        }

        return array_unique($aOut);
    }
}
{'fraction_non_alphanumeric': 0.2339877695526231, 'fraction_numerical': 0.0, 'mean_word_length': 1.488390712570056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '6111059', 'n_tokens_mistral': 900, 'n_tokens_neox': 873, 'n_words': 196}