<commit_before><?php
namespace SyHolloway\MrColor;

use SyHolloway\MrColor\Color;
use SyHolloway\MrColor\Extension;
use SyHolloway\MrColor\Extension\Test;
use SyHolloway\MrColor\Extension\Toolkit;
use SyHolloway\MrColor\Extension\Formatter;

/**
 * Provides a collection manager for MrColor extensions
 *
 * @package MrColor
 * @author <NAME>
 */
class ExtensionCollection
{
    
    private $extensions = array();
    
    private static $defaults = array();
    
    private static $init = false;
    
    public function __construct()
    {
        if( ! self::$init )
        {
            self::init();
        }
        
        $this->extensions = self::$defaults;
    }
    
    public function runAll(Color $color, $method, $args)
    {
        $result = null;
        
        foreach($this->extensions as $extension)
        {
            if(true === $extension->query($method))
            {
                $result = $extension->trigger($color, $method, $args);
                
                break;
            }
        }
        
        return $result;
    }
    
    public static function registerExtension(Extension $extension)
    {
        $this->extensions[] = $extension;
    }
    
    public static function deregisterExtension(Extension $extension)
    {
        foreach($this->extensions as $key => $posext)
        {
            //If objects of same class
            if($posext == $extension)
            {
                unset($this->extensions[$key]);
            }
        }
    }
    
    public static function registerDefaultExtension(Extension $extension)
    {
        self::$defaults[] = $extension;
    }
    
    public static function deregisterDefaultExtension(Extension $extension)
    {
        foreach(self::$defaults as $key => $posext)
        {
            //If objects of same class
            if($posext == $extension)
            {
                unset(self::$defaults[$key]);
            }
        }
    }
    
    public function init()
    {
        self::$init = true;
        
        self::registerDefaultExtension(new Test());
        self::registerDefaultExtension(new Toolkit());
        self::registerDefaultExtension(new Formatter());
    }
}<commit_msg>PSR-2'd it up<commit_after><?php
namespace SyHolloway\MrColor;

use SyHolloway\MrColor\Color;
use SyHolloway\MrColor\Extension;
use SyHolloway\MrColor\Extension\Test;
use SyHolloway\MrColor\Extension\Toolkit;
use SyHolloway\MrColor\Extension\Formatter;

/**
 * Provides a collection manager for MrColor extensions
 *
 * @package MrColor
 * @author <NAME>
 */
class ExtensionCollection
{
    /**
     * Hold an array of Extension objects
     * @var array
     */
    private $extensions = array();

    /**
     * Hold an array of default Extension objects
     * @var array
     */
    private static $defaults = array();

    /**
     * Is the ExtensionCollection initialized yet?
     * @var boolean
     */
    private static $init = false;

    public function __construct()
    {
        if (! self::$init) {
            self::init();
        }

        $this->extensions = self::$defaults;
    }

    public function runAll(Color $color, $method, $args)
    {
        $result = null;

        foreach ($this->extensions as $extension) {

            if (true === $extension->query($method)) {

                $result = $extension->trigger($color, $method, $args);

                break;
            }
        }

        return $result;
    }

    public static function registerExtension(Extension $extension)
    {
        $this->extensions[] = $extension;
    }

    public static function deregisterExtension(Extension $extension)
    {
        foreach ($this->extensions as $key => $posext) {
            //If objects of same class
            if ($posext == $extension) {
                unset($this->extensions[$key]);
            }
        }
    }

    public static function registerDefaultExtension(Extension $extension)
    {
        self::$defaults[] = $extension;
    }

    public static function deregisterDefaultExtension(Extension $extension)
    {
        foreach (self::$defaults as $key => $posext) {
            //If objects of same class
            if ($posext == $extension) {
                unset(self::$defaults[$key]);
            }
        }
    }

    public function init()
    {
        self::$init = true;

        self::registerDefaultExtension(new Test());
        self::registerDefaultExtension(new Toolkit());
        self::registerDefaultExtension(new Formatter());
    }
}
{'fraction_non_alphanumeric': 0.11737502752697644, 'fraction_numerical': 0.00022021581149526536, 'mean_word_length': 1.9861932938856015, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '3129880', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1209, 'n_words': 280}