<commit_before><?php
namespace rjapi\extension;

use rjapi\types\ConfigInterface;
use rjapi\types\PhpInterface;

/**
 * Class SpellCheckTrait
 *
 * @package rjapi\extension
 *
 * @property ApiController entity
 */
trait SpellCheckTrait
{
    /**
     * Field spell checker
     *
     * @param array $jsonProps
     *
     * @return array
     */
    protected function spellCheck(array $jsonProps)
    {
        $arr        = [];
        $spellCheck = new SpellCheck($this->entity);
        $field      = $spellCheck->getField();
        if (true === $spellCheck->isEnabled()) {
            if (false === extension_loaded(PhpInterface::PHP_EXTENSION_PSPELL)) {
                return [ConfigInterface::SPELL_CHECK => 'php-pspell library has not been installed on Your system.'];
            }
            $arr = $spellCheck->check($jsonProps[$field]);
        }

        return [ConfigInterface::SPELL_CHECK => [$field => $arr]];
    }
}<commit_msg>#98. Change extension_loaded check<commit_after><?php
namespace rjapi\extension;

use rjapi\types\ConfigInterface;
use rjapi\types\PhpInterface;

/**
 * Class SpellCheckTrait
 *
 * @package rjapi\extension
 *
 * @property ApiController entity
 */
trait SpellCheckTrait
{
    /**
     * Field spell checker
     *
     * @param array $jsonProps
     *
     * @return array
     */
    protected function spellCheck(array $jsonProps) : array
    {
        if (false === extension_loaded(PhpInterface::PHP_EXTENSION_PSPELL)) {
            return [ConfigInterface::SPELL_CHECK => 'php-pspell library has not been installed on Your system.'];
        }
        $arr        = [];
        $spellCheck = new SpellCheck($this->entity);
        $field      = $spellCheck->getField();
        if (true === $spellCheck->isEnabled()) {
            $arr = $spellCheck->check($jsonProps[$field]);
        }

        return [ConfigInterface::SPELL_CHECK => [$field => $arr]];
    }
}
{'fraction_non_alphanumeric': 0.13302034428794993, 'fraction_numerical': 0.0010432968179447052, 'mean_word_length': 2.5716945996275604, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5981296', 'n_tokens_mistral': 576, 'n_tokens_neox': 580, 'n_words': 118}