@param OrderListMessage $message

@return Order[]
761421
public function getOrders(OrderListMessage $message): array
    {
        $path = 'orders';

        $response = $this->getClient()->sendRequest('GET', $path, $message->build());

        /** @var Order[] $models */
        $models = $this->getModelFactory()->createMany(Order::class, $response['data']);

        return $models;
    }
1264508
protected function attachments(SlackMessage $message)
    {
        return collect($message->attachments)->map(function ($attachment) use ($message) {
            return array_filter([
                'color' => $attachment->color ?: $message->color(),
                'title' => $attachment->title,
                'text' => $attachment->content,
                'fallback' => $attachment->fallback,
                'title_link' => $attachment->url,
                'fields' => $this->fields($attachment),
                'mrkdwn_in' => $attachment->markdown,
                'footer' => $attachment->footer,
                'footer_icon' => $attachment->footerIcon,
                'ts' => $attachment->timestamp,
            ]);
        })->all();
    }
1033142
public function push(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        $this->queueDeclare($queue);

        $options = [
            'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT,
        ];

        if ($message->getDelay() > 0) {
            $options['application_headers'] = new AMQPTable(
                [
                    'x-delay' => $message->getDelay(),
                ]
            );
        }

        $msg = new AMQPMessage(json_encode($message), $options);

        $this->channel->basic_publish($msg, '', $queue);

        return 1;
    }
1112847
protected function denormaliseMessages($messages)
    {
        // Sort prior to denormalisation
        ksort($messages);
        $entities = [];
        foreach ($messages as $entity => $value) {
            // Skip un-namespaced keys
            $value = $this->denormaliseValue($value);

            // Non-nested key
            if (strstr($entity, '.') === false) {
                $entities[$entity] = $value;
                continue;
            }

            // Get key nested within class
            list($class, $key) = $this->getClassKey($entity);
            if (!isset($entities[$class])) {
                $entities[$class] = [];
            }

            $entities[$class][$key] = $value;
        }
        return $entities;
    }
434746
public function format($message, array $references = array())
    {
        // sort references by start indice
        // for testing issue we need to add @
        // @see https://github.com/phpspec/prophecy/issues/161
        @uasort($references, function ($a, $b) {
            return $a->getStartIndice() > $b->getStartIndice();
        });

        $messageParts = $this->buildMessageParts($message, $references);

        // build message
        $formattedMessageParts = array();

        foreach ($messageParts as $messagePart) {
            if (is_null($messagePart)) {
                continue;
            }

            $formattedMessageParts[] = $this->formatMessagePart($messagePart);
        }

        return implode($formattedMessageParts);
    }
286450
public function alias(array $message) {
    $message = $this->message($message);
    $message["type"] = "alias";

    return $this->consumer->alias($message);
  }
863343
public function release(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        $time = new \DateTimeImmutable('now');
        $time = $time->modify('+' . $message->getDelay() . 'seconds');

        $values = [
            'id' => $message->getId(),
            'queue' => $queue,
            'reserved' => null,
            'visibility' => $time->format('Y-m-d H:i:s'),
        ];

        $sql = 'UPDATE ' . $this->table .
            ' SET reserved = :reserved, visibility = :visibility' .
            ' WHERE id = :id AND queue = :queue';

        $stat = $this->pdo->prepare($sql);

        $stat->execute($values);

        return $this;
    }
1020276
private function getUserMessages(Message $message)
    {
        $currentUser = $this->tokenStorage->getToken()->getUser();

        return $this->om->getRepository(UserMessage::class)->findBy(['message' => $message, 'user' => $currentUser]);
    }
309356
protected function getRecipients( Swift_Mime_Message $message )
	{
		$to = [];

		if ( $message->getTo() )
			$to = array_merge( $to, array_keys( $message->getTo() ) );

		if ( $message->getCc() )
			$to = array_merge( $to, array_keys( $message->getCc() ) );

		if ( $message->getBcc() )
			$to = array_merge( $to, array_keys( $message->getBcc() ) );

		$recipients = array_map( function ( $address )
		{
			return compact( 'address' );
		}, $to );

		return $recipients;
	}
720515
protected function formatMessage($message)
    {
        if (is_array($message)) {
            $message = var_export($message, true);
        } elseif (is_object($message)) {
            $message = get_object_vars($message);
        }

        return $message;
    }
747683
protected function applyMessageOptions(Message $message)
    {
        if (empty($this->config['message']['options']) || !is_array($this->config['message']['options'])) {
            return $message;
        }

        foreach ($this->config['message']['options'] as $key => $value) {
            $method = 'set'.ucfirst($key);

            if (is_callable(array($message, $method))) {
                if (!is_array($value)) {
                    $value = array($value);
                }
                call_user_func_array(array($message, $method), $value);
            }
        }

        return $message;
    }
528034
private function getNestedMessages(Message $message, Schema $schema): array
    {
        $messages = [];

        foreach ($schema->getFields() as $field) {
            if (!$field->getType()->isMessage()) {
                continue;
            }

            if (!$message->has($field->getName())) {
                continue;
            }

            if ($field->isASingleValue()) {
                $messages[] = $message->get($field->getName());
            } else {
                $messages = array_merge($messages, array_values($message->get($field->getName())));
            }
        }

        return $messages;
    }
484582
public function transform(Template $message)
    {
        if (empty($message->getText())) {
            throw new RequiredArgumentException('Text is required');
        }

        return [
            'template_type' => 'button',
            'text' => $message->getText(),
            'buttons' => $message->getCollections()->toData(),
        ];
    }
1079215
public function unpack(string $message): array
    {
        $messageAry = json_decode($message, true);
        $type       = $messageAry['pipeType'];
        $data       = $messageAry['message'];

        return [$type, $data];
    }
18722
public function transformTextCard(AbstractMessage $message)
    {
        return [
            'msgtype'  => 'textcard',
            'textcard' => [
                'title'       => $message->get('title'),
                'description' => $message->get('description'),
                'url'         => $message->get('url'),
                'btntxt'      => $message->get('btntxt'),
            ],
        ];
    }
1360231
protected function buildRecipients($message)
    {
        foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) {
            foreach ($this->{$type} as $recipient) {
                $message->{$type}($recipient['address'], $recipient['name']);
            }
        }

        return $this;
    }
13805
protected function getToAddresses( Swift_Mime_Message $message )
	{
		$to = [];

		if ( $message->getTo() )
			$to = array_merge( $to, array_keys( $message->getTo() ) );

		if ( $message->getCc() )
			$to = array_merge( $to, array_keys( $message->getCc() ) );

		if ( $message->getBcc() )
			$to = array_merge( $to, array_keys( $message->getBcc() ) );

		return $to;
	}