<commit_before><?php

/**
 * The class provides an interface for triggering and subscribing to events
 *
 * @package     Nails
 * @subpackage  common
 * @category    Library
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Common\Service;

use Nails\Components;

/**
 * Class Event
 *
 * @package Nails\Common\Service
 */
class Event
{
    /**
     * The event subscriptions
     *
     * @var array
     */
    protected $aSubscriptions;

    // --------------------------------------------------------------------------

    /**
     * Tracks events which have been triggered
     *
     * @var array
     */
    protected $aHistory = [];

    // --------------------------------------------------------------------------

    /**
     * Event constructor.
     */
    public function __construct()
    {
        //  Defaults
        $this->aSubscriptions = [];

        //  Set up initial subscriptions
        foreach (Components::available() as $oComponent) {
            if (!empty($oComponent->namespace)) {
                $this->autoLoadSubscriptions($oComponent->namespace);
            }
        }

        //  Any subscriptions for the app?
        $this->autoLoadSubscriptions('App\\');
    }

    // --------------------------------------------------------------------------

    /**
     * Looks for a component's event handler and executes the autoload() method if there is one
     *
     * @param string $sNamespace The namespace to check<commit_msg>No need to laod App listeners independently<commit_after><?php

/**
 * The class provides an interface for triggering and subscribing to events
 *
 * @package     Nails
 * @subpackage  common
 * @category    Library
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Common\Service;

use Nails\Components;

/**
 * Class Event
 *
 * @package Nails\Common\Service
 */
class Event
{
    /**
     * The event subscriptions
     *
     * @var array
     */
    protected $aSubscriptions;

    // --------------------------------------------------------------------------

    /**
     * Tracks events which have been triggered
     *
     * @var array
     */
    protected $aHistory = [];

    // --------------------------------------------------------------------------

    /**
     * Event constructor.
     */
    public function __construct()
    {
        //  Defaults
        $this->aSubscriptions = [];

        //  Set up initial subscriptions
        foreach (Components::available() as $oComponent) {
            if (!empty($oComponent->namespace)) {
                $this->autoLoadSubscriptions($oComponent->namespace);
            }
        }
    }

    // --------------------------------------------------------------------------

    /**
     * Looks for a component's event handler and executes the autoload() method if there is one
     *
     * @param string $sNamespace The namespace to check
{'fraction_non_alphanumeric': 0.2480165574335978, 'fraction_numerical': 0.0, 'mean_word_length': 1.2603273577552612, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '2461864', 'n_tokens_mistral': 697, 'n_tokens_neox': 671, 'n_words': 191}