<commit_before><?php

namespace Zeus;

/**
 * Defines a Singleton structure, meant to be extends by classes that
 * needs to be instantiated  just once during the execution
 */
abstract class Singleton
{

    /**
     * No singleton class can be cloned
     * @throws \Exception When you try to clone
     */
    final private function __clone()
    {
        throw new \Exception('Cannot clone a singleton class');
    }

    /**
     * Returns the static instance of the Singleton called class
     * @return Singleton
     */
    public static function getInstance()
    {
        static $instances = array();
        $calledClass = get_called_class();
        if (!isset($instances[$calledClass])) {
            $instances[$calledClass] = new $calledClass();
        }
        return $instances[$calledClass];
    }

}
<commit_msg>adding support to params at sigleton first use<commit_after><?php

namespace Zeus;

/**
 * Defines a Singleton structure, meant to be extends by classes that
 * needs to be instantiated  just once during the execution
 */
abstract class Singleton
{

    /**
     * No singleton class can be cloned
     * @throws \Exception When you try to clone
     */
    final private function __clone()
    {
        throw new \Exception('Cannot clone a singleton class');
    }

    /**
     * Returns the static instance of the Singleton called class
     * @return Singleton
     */
    public static function getInstance($_ = null)
    {
        static $instances = array();
        $calledClass = get_called_class();
        if (!isset($instances[$calledClass])) {
            $params = func_get_args();
            $instances[$calledClass] = new $calledClass(...$params);
        }
        return $instances[$calledClass];
    }

}

{'fraction_non_alphanumeric': 0.09937535491198182, 'fraction_numerical': 0.0, 'mean_word_length': 2.4822134387351777, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2710690', 'n_tokens_mistral': 471, 'n_tokens_neox': 460, 'n_words': 164}