<commit_before><?php

namespace Arch;

/**
 * Class event
 */
class Event
{

    protected $name;
    protected $callback;
    protected $target;
    
    public function __construct($name, $callback)
    {
        $this->name = $name;
        $this->callback = $callback;
    }
    
    public function trigger($target = null)
    {
        $target = empty($target) ? $this->target : $target;
        $fn = $this->callback;
        if (is_callable($fn)) {
            $fn($target);
        }
    }
}<commit_msg>Set optional target for \Arch\Event<commit_after><?php

namespace Arch;

/**
 * Class event
 */
class Event
{
    
    /**
     * The event name
     * @var string
     */
    protected $name;
    
    /**
     * The event callback
     * @var mixed
     */
    protected $callback;
    
    /**
     * Returns a new event
     * @param string $name The event name
     * @param mixed $callback The event callback
     */
    public function __construct($name, $callback)
    {
        $this->name = $name;
        $this->callback = $callback;
    }
    
    /**
     * Triggers this event
     * @param mixed $target An optional target
     */
    public function trigger($target = null)
    {
        $fn = $this->callback;
        if (is_callable($fn)) {
            $fn($target);
        }
    }
}
{'fraction_non_alphanumeric': 0.13328255902513328, 'fraction_numerical': 0.0, 'mean_word_length': 1.7898089171974523, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '4581818', 'n_tokens_mistral': 396, 'n_tokens_neox': 396, 'n_words': 101}