<commit_before><?php

use Illuminate\Support\Arr;
use Illuminate\Container\Container;
use Nuwber\Events\Event\Publisher;
use Nuwber\Events\Event\ShouldPublish;

if (!function_exists('publish')) {

    function publish($event, array $payload = [])
    {
        if (is_string($event)) {
            $event = new class($event, $payload) implements ShouldPublish {
                private $event;
                private $payload;

                public function __construct(string $event, array $payload = [])
                {
                    $this->event = $event;
                    $this->payload = Arr::isAssoc($payload) ? [$payload] : Arr::wrap($payload);
                }

                public function publishEventKey(): string
                {
                    return $this->event;
                }

                public function toPublish(): array
                {
                    return $this->payload;
                }
            };
        }
        
        Container::getInstance()
            ->get(Publisher::class)
            ->publish($event);
    }

}<commit_msg>replace get with make (#80)<commit_after><?php

use Illuminate\Support\Arr;
use Illuminate\Container\Container;
use Nuwber\Events\Event\Publisher;
use Nuwber\Events\Event\ShouldPublish;

if (!function_exists('publish')) {

    function publish($event, array $payload = [])
    {
        if (is_string($event)) {
            $event = new class($event, $payload) implements ShouldPublish {
                private $event;
                private $payload;

                public function __construct(string $event, array $payload = [])
                {
                    $this->event = $event;
                    $this->payload = Arr::isAssoc($payload) ? [$payload] : Arr::wrap($payload);
                }

                public function publishEventKey(): string
                {
                    return $this->event;
                }

                public function toPublish(): array
                {
                    return $this->payload;
                }
            };
        }

        Container::getInstance()
            ->make(Publisher::class)
            ->publish($event);
    }

}
{'fraction_non_alphanumeric': 0.11772665764546685, 'fraction_numerical': 0.0009021199819576004, 'mean_word_length': 1.4837625979843225, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '3776668', 'n_tokens_mistral': 578, 'n_tokens_neox': 538, 'n_words': 112}