<commit_before><?php
namespace Apix\Plugin;

abstract class PluginAbstract implements \SplObserver
{

    protected $adapter = null;
    protected $options = array();

    /**
     * Constructor
     *
     * @param mix $options Array of options
     */
    public function __construct($options=null)
    {
        $this->setOptions($options);

        if (isset($this->options['adapter'])) {
            $this->setAdapter($this->options['adapter']);

            if( isset(static::$hook) && isset(static::$hook['interface'])) {
                $this->checkAdapterClass(
                    $this->adapter,
                    static::$hook['interface']
                );
            }
        }
    }

    /**
     * Checks the adapter comply to a class/interface
     *
     * @param closure|object $adapter
     * @throws \RuntimeException
     * @return true
     */
    public function checkAdapterClass($adapter, $class)
    {
        if(!is_subclass_of($adapter, $class)) {
            throw new \RuntimeException(
                sprintf('%s not implemented.', $class)
            );
        }

        return true;
    }

    /**<commit_msg>Typo.<commit_after><?php
namespace Apix\Plugin;

abstract class PluginAbstract implements \SplObserver
{

    protected $adapter = null;
    protected $options = array();

    /**
     * Constructor
     *
     * @param mix $options Array of options
     */
    public function __construct($options=null)
    {
        $this->setOptions($options);

        if (isset($this->options['adapter'])) {
            $this->setAdapter($this->options['adapter']);

            if( isset(static::$hook) && isset(static::$hook['interface'])) {
                $this->checkAdapterClass(
                    $this->adapter,
                    static::$hook['interface']
                );
            }
        }
    }

    /**
     * Checks the adapter comply to a class/interface
     *
     * @param   object              $adapter
     * @throws  \RuntimeException
     * @return true
     */
    public function checkAdapterClass($adapter, $class)
    {
        if(!is_subclass_of($adapter, $class)) {
            throw new \RuntimeException(
                sprintf('%s not implemented.', $class)
            );
        }

        return true;
    }

    /**
{'fraction_non_alphanumeric': 0.13292788879235448, 'fraction_numerical': 0.0, 'mean_word_length': 1.774698795180723, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5885721', 'n_tokens_mistral': 615, 'n_tokens_neox': 600, 'n_words': 126}