<commit_before><?php
namespace Enum\Model\Behavior\Strategy;

use Cake\ORM\Table;
use Cake\Utility\Inflector;
use RuntimeException;

abstract class AbstractStrategy
{
    /**
     * List of defined group prefixes.
     *
     * @var array
     */
    protected $_prefixes = [];

    /**
     * Target table.
     *
     * @var |Cake\ORM\Table
     */
    protected $_table;

    /**
     * @param array $config Configuration.
     * @param \Cake\ORM\Table $table Target table.
     */
    public function __construct($alias, Table $table)
    {
        $this->_alias = $alias;
        $this->_table = $table;
    }

    /**
     * @param string $prefix Prefix.
     * @return bool
     */
    abstract public function hasPrefix($prefix);

    /**
     * @return array
     */
    abstract public function listPrefixes();

    /**
     * @param array $config
     * @return array
     */
    abstract public function enum(array $config);

    /**
     * @param string $key
     * @return string
     */
    abstract public function get($key);

    /**
     * @param string $group Group name.
     * @param array $config Configuration.
     * @return array
     * @throws \RuntimeException if group's prefix is not defined.
     */
    public function initialize($config)
    {
        if (is_string($config)) {
            $config = ['prefix' => $config];
        }

        if (empty($config['prefix'])) {
            $prefix = Inflector::underscore(Inflector::singularize($this->_table->alias()));
            $prefix .= '_' . $this->_alias;
            if (!$this->hasPrefix($prefix)) {
                if (!$this->hasPrefix($this->_alias)) {
                    throw new RuntimeException(sprintf('Undefined prefix for provider (%s)', $this->_alias));
                }
                $prefix = $this->_alias;
            }
            $config += ['prefix' => strtoupper($prefix)];<commit_msg>Fix exception message<commit_after><?php
namespace Enum\Model\Behavior\Strategy;

use Cake\ORM\Table;
use Cake\Utility\Inflector;
use RuntimeException;

abstract class AbstractStrategy
{
    /**
     * List of defined group prefixes.
     *
     * @var array
     */
    protected $_prefixes = [];

    /**
     * Target table.
     *
     * @var |Cake\ORM\Table
     */
    protected $_table;

    /**
     * @param array $config Configuration.
     * @param \Cake\ORM\Table $table Target table.
     */
    public function __construct($alias, Table $table)
    {
        $this->_alias = $alias;
        $this->_table = $table;
    }

    /**
     * @param string $prefix Prefix.
     * @return bool
     */
    abstract public function hasPrefix($prefix);

    /**
     * @return array
     */
    abstract public function listPrefixes();

    /**
     * @param array $config
     * @return array
     */
    abstract public function enum(array $config);

    /**
     * @param string $key
     * @return string
     */
    abstract public function get($key);

    /**
     * @param string $group Group name.
     * @param array $config Configuration.
     * @return array
     * @throws \RuntimeException if group's prefix is not defined.
     */
    public function initialize($config)
    {
        if (is_string($config)) {
            $config = ['prefix' => $config];
        }

        if (empty($config['prefix'])) {
            $prefix = Inflector::underscore(Inflector::singularize($this->_table->alias()));
            $prefix .= '_' . $this->_alias;
            if (!$this->hasPrefix($prefix)) {
                if (!$this->hasPrefix($this->_alias)) {
                    throw new RuntimeException(sprintf('Undefined prefix for strategy (%s)', $this->_alias));
                }
                $prefix = $this->_alias;
            }
            $config += ['prefix' => strtoupper($prefix)];
{'fraction_non_alphanumeric': 0.14255654918463967, 'fraction_numerical': 0.0, 'mean_word_length': 1.9734167318217357, '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': '2487785', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1048, 'n_words': 261}