<commit_before><?php namespace Mascame\Artificer\Extension;

use Illuminate\Support\Str;
use Mascame\Extender\Booter\BooterInterface;
use Mascame\Extender\Event\EventInterface;
use Mascame\Extender\Installer\InstallerInterface;
use Symfony\Component\CssSelector\XPath\Extension\AbstractExtension;
use Symfony\Component\HttpFoundation\File\File;

class Manager extends \Mascame\Extender\Manager {

    /**
     * @var \Mascame\Artificer\Plugin\Manager|\Mascame\Artificer\Widget\Manager
     */
    protected $manager;

    /**
     * Composer packages
     * 
     * @var array
     */
    protected $packages = [];

    /**
     * @param InstallerInterface $installer
     * @param BooterInterface|null $booter
     * @param EventInterface|null $eventDispatcher
     * @throws \Exception
     */
    public function __construct(
        InstallerInterface $installer,
        BooterInterface $booter = null,
        EventInterface $eventDispatcher = null
    )
    {
        parent::__construct($installer, $booter, $eventDispatcher);

        $this->packages = $this->getPackagesVersions();
    }

    /**
     * @param $name
     * @param \Closure $plugin
     */
    public function add($name, \Closure $plugin)
    {
        if (! $this->isValidNamespace($name)) {
            throw new \Exception('Extension namespace is mandatory and must be compliant to "vendor/package". Provided: ' . $name);
        }

        parent::add($name, $plugin);
    }
    
    /**
     * vendor/package
     *
     * @param $namespace
     * @return bool
     */
    protected function isValidNamespace($namespace) {
        $regex = "/^[\\w-]+\\/[\\w-]+$/";
<commit_msg>= don't assume closure in interface<commit_after><?php namespace Mascame\Artificer\Extension;

use Illuminate\Support\Str;
use Mascame\Extender\Booter\BooterInterface;
use Mascame\Extender\Event\EventInterface;
use Mascame\Extender\Installer\InstallerInterface;
use Symfony\Component\CssSelector\XPath\Extension\AbstractExtension;
use Symfony\Component\HttpFoundation\File\File;

class Manager extends \Mascame\Extender\Manager {

    /**
     * @var \Mascame\Artificer\Plugin\Manager|\Mascame\Artificer\Widget\Manager
     */
    protected $manager;

    /**
     * Composer packages
     * 
     * @var array
     */
    protected $packages = [];

    /**
     * @param InstallerInterface $installer
     * @param BooterInterface|null $booter
     * @param EventInterface|null $eventDispatcher
     * @throws \Exception
     */
    public function __construct(
        InstallerInterface $installer,
        BooterInterface $booter = null,
        EventInterface $eventDispatcher = null
    )
    {
        parent::__construct($installer, $booter, $eventDispatcher);

        $this->packages = $this->getPackagesVersions();
    }

    /**
     * @param $name
     * @param $plugin
     */
    public function add($name, $plugin)
    {
        if (! $this->isValidNamespace($name)) {
            throw new \Exception('Extension namespace is mandatory and must be compliant to "vendor/package". Provided: ' . $name);
        }

        parent::add($name, $plugin);
    }
    
    /**
     * vendor/package
     *
     * @param $namespace
     * @return bool
     */
    protected function isValidNamespace($namespace) {
        $regex = "/^[\\w-]+\\/[\\w-]+$/";

{'fraction_non_alphanumeric': 0.12831325301204818, 'fraction_numerical': 0.0, 'mean_word_length': 2.6494505494505494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3594545', 'n_tokens_mistral': 991, 'n_tokens_neox': 969, 'n_words': 191}