<commit_before><?php

namespace Bschmitt\Amqp;

use Closure;
use Bschmitt\Amqp\Request;
use Bschmitt\Amqp\Message;
use Illuminate\Support\Facades\App;

/**
 * @author <NAME> <<EMAIL>>
 */
class Amqp
{
    protected static $batchMessages = [];

    /**
     * @param string $routing
     * @param mixed  $message
     * @param array  $properties
     *
     * @return bool|null
     *
     * @throws Exception\Configuration
     * @throws \Exception
     */
    public function publish($routing, $message, array $properties = []) : ?bool
    {
        $properties['routing'] = $routing;

        /* @var Publisher $publisher */

        $publisher = App::make(Publisher::class);

        $publisher
            ->mergeProperties($properties)
            ->setup();

        if (is_string($message)) {
            $message = new Message($message, ['content_type' => 'text/plain', 'delivery_mode' => 2]);
        }

        $mandatory = false;
        if (isset($properties['mandatory']) && $properties['mandatory'] == true) {
            $mandatory = true;
        }

        $return = $publisher->publish($routing, $message, $mandatory);
        Request::shutdown($publisher->getChannel(), $publisher->getConnection());

        return $return;
    }

    /**
     * @param string $routing
     * @param mixed  $message
     */
    public function batchBasicPublish(string $routing, $message)
    {
        self::$batchMessages[] = [
            'routing' => $routing,
            'message' => $message,
        ];
    }

    /**
     * @param array $properties
     *
     * @throws Exception\Configuration
     * @throws \Exception
     */
    public function batchPublish(array $properties = [])
    {
        /* @var Publisher $publisher */
        $publisher = App::make(Publisher::class);
        $publisher
            ->mergeProperties($properties)
            ->setup();

        foreach(self::$batchMessages as $messageData) {
            if (is_string($messageData['message'])) {
                $messageData['message'] = new Message($messageData, ['content_type' => 'text/plain', 'delivery_mode' => 2]);
            }

            $publisher->batchBasicPublish($messageData['routing'], $messageData['message']);
        }
<commit_msg>Pass in messageData message container not entire array<commit_after><?php

namespace Bschmitt\Amqp;

use Closure;
use Bschmitt\Amqp\Request;
use Bschmitt\Amqp\Message;
use Illuminate\Support\Facades\App;

/**
 * @author <NAME> <<EMAIL>>
 */
class Amqp
{
    protected static $batchMessages = [];

    /**
     * @param string $routing
     * @param mixed  $message
     * @param array  $properties
     *
     * @return bool|null
     *
     * @throws Exception\Configuration
     * @throws \Exception
     */
    public function publish($routing, $message, array $properties = []) : ?bool
    {
        $properties['routing'] = $routing;

        /* @var Publisher $publisher */

        $publisher = App::make(Publisher::class);

        $publisher
            ->mergeProperties($properties)
            ->setup();

        if (is_string($message)) {
            $message = new Message($message, ['content_type' => 'text/plain', 'delivery_mode' => 2]);
        }

        $mandatory = false;
        if (isset($properties['mandatory']) && $properties['mandatory'] == true) {
            $mandatory = true;
        }

        $return = $publisher->publish($routing, $message, $mandatory);
        Request::shutdown($publisher->getChannel(), $publisher->getConnection());

        return $return;
    }

    /**
     * @param string $routing
     * @param mixed  $message
     */
    public function batchBasicPublish(string $routing, $message)
    {
        self::$batchMessages[] = [
            'routing' => $routing,
            'message' => $message,
        ];
    }

    /**
     * @param array $properties
     *
     * @throws Exception\Configuration
     * @throws \Exception
     */
    public function batchPublish(array $properties = [])
    {
        /* @var Publisher $publisher */
        $publisher = App::make(Publisher::class);
        $publisher
            ->mergeProperties($properties)
            ->setup();

        foreach(self::$batchMessages as $messageData) {
            if (is_string($messageData['message'])) {
                $messageData['message'] = new Message($messageData['message'], ['content_type' => 'text/plain', 'delivery_mode' => 2]);
            }

            $publisher->batchBasicPublish($messageData['routing'], $messageData['message']);
        }

{'fraction_non_alphanumeric': 0.15191545574636725, 'fraction_numerical': 0.0008806693086745927, 'mean_word_length': 2.3257686676427527, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, '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': '4757074', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1280, 'n_words': 257}