@param IncomingLogicalMessage         $logicalMessage
@param IncomingPhysicalMessageContext $parentContext

@return IncomingLogicalMessageContext
484219
public function createLogicalMessageContext(
        IncomingLogicalMessage $logicalMessage,
        IncomingPhysicalMessageContext $parentContext
    ) {
        return new IncomingLogicalMessageContext(
            $logicalMessage,
            $parentContext->getMessageId(),
            $parentContext->getHeaders(),
            $parentContext->getIncomingPhysicalMessage(),
            $parentContext->getPendingTransportOperations(),
            $this->busOperations,
            $this->outgoingOptionsFactory,
            $parentContext->getEndpointControlToken(),
            $parentContext
        );
    }
709379
protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
    {
        if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
            $parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
        } else {
            unset($parentContext[self::ATTRIBUTES]);
        }

        return $parentContext;
    }
269905
public function send(Message $message, string $connectionName = null): MessageEnvelope
    {
        if (!$this->handles($message)) {
            throw new LogicException('Message of type ' . get_class($message) . " couldn't be handled by this notifier");
        }

        return $this->sendMessage($message, $connectionName);
    }
1297394
protected Message createMessage(ConnectionContext context, BasicMessage basicMessage) throws JMSException {
        return createMessage(context, basicMessage, null);
    }
630347
public function createLogicalMessageContextFromPublishContext(
        OutgoingPublishContext $parentContext
    ) {
        return new OutgoingLogicalMessageContext(
            $parentContext->getMessageId(),
            $parentContext->getHeaders(),
            $parentContext->getLogicalMessage(),
            [new MulticastAddressTag($parentContext->getLogicalMessage()->getMessageClass())],
            $parentContext->getPublishOptions()->isImmediateDispatchEnabled(),
            $parentContext->getIncomingPhysicalMessage(),
            $parentContext->getPendingTransportOperations(),
            $parentContext
        );
    }
1228350
protected function generateMessage(FileDescriptorProto $fileDescriptor, DescriptorProto $messageDescriptor, $parent = null)
    {
        $type   = Entity::TYPE_MESSAGE;
        $name   = $messageDescriptor->getName();
        $entity = new Entity($type, $name, $messageDescriptor, $fileDescriptor, $parent);

        if ($messageDescriptor->hasExtensionList() && $this->containsProtobufExtension($messageDescriptor->getExtensionList())) {
            $entity->setProtobufExtension(true);
        }

        return $entity;
    }
658205
public function setAsChildContainerOf(DelegateInterface $parentContainer) : DelegateInterface
    {
        $this->setParentContainer($parentContainer);
        $parentContainer->addChildContainer($this);
        return $this;
    }
186239
public function createLogicalMessageContextFromReplyContext($replyToAddress, OutgoingReplyContext $parentContext)
    {
        return new OutgoingLogicalMessageContext(
            $parentContext->getMessageId(),
            $parentContext->getHeaders(),
            $parentContext->getLogicalMessage(),
            [new UnicastAddressTag($replyToAddress)],
            $parentContext->getReplyOptions()->isImmediateDispatchEnabled(),
            $parentContext->getIncomingPhysicalMessage(),
            $parentContext->getPendingTransportOperations(),
            $parentContext
        );
    }
1306351
private function getHeaderPasteNewButton(ModelInterface $parentModel, EnvironmentInterface $environment)
    {
        $basicDefinition = $environment->getDataDefinition()->getBasicDefinition();
        if (!$basicDefinition->isCreatable()) {
            return null;
        }

        $filter = new Filter();
        $filter->andModelIsFromProvider($basicDefinition->getDataProvider());
        if ($parentDataProviderName = $basicDefinition->getParentDataProvider()) {
            $filter->andParentIsFromProvider($parentDataProviderName);
        } else {
            $filter->andHasNoParent();
        }

        if ($environment->getClipboard()->isNotEmpty($filter)) {
            return null;
        }
        $dispatcher = $environment->getEventDispatcher();

        /** @var AddToUrlEvent $urlEvent */
        $urlEvent = $dispatcher->dispatch(
            ContaoEvents::BACKEND_ADD_TO_URL,
            new AddToUrlEvent('act=create&amp;pid=' . ModelId::fromModel($parentModel)->getSerialized())
        );

        $parentDefinition = $environment->getParentDataDefinition();
        /** @var GenerateHtmlEvent $imageEvent */
        $imageEvent = $dispatcher->dispatch(
            ContaoEvents::IMAGE_GET_HTML,
            new GenerateHtmlEvent(
                'new.svg',
                $this->translate('pastenew.0', $parentDefinition->getName())
            )
        );

        return \sprintf(
            '<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a>',
            $urlEvent->getUrl(),
            StringUtil::specialchars($this->translate('pastenew.0', $parentDefinition->getName())),
            $imageEvent->getHtml()
        );
    }
846653
public function setMaxMessage($maxMessage)
    {
        if (!is_string($maxMessage)) {
            throw new \InvalidArgumentException('The attribute maxMessage on the class Attribute has to be string (' . gettype($maxMessage) . ('object' === gettype($maxMessage) ? ' ' . get_class($maxMessage) : '') . ' given).');
        }

        $this->maxMessage = $maxMessage;

        return $this;
    }
717516
private function getParentModelButtons($parentModel, EnvironmentInterface $environment)
    {
        if ('select' === $environment->getInputProvider()->getParameter('act')) {
            return '';
        }

        $config = $environment->getBaseConfigRegistry()->getBaseConfig();
        $environment->getView()->getPanel()->initialize($config);
        if (!$config->getSorting()) {
            return '';
        }

        return \implode(
            ' ',
            [
                'editHeader' => $this->getHeaderEditButton($parentModel, $environment),
                'pasteNew' => $this->getHeaderPasteNewButton($parentModel, $environment),
                'pasteAfter' => $this->getHeaderPasteTopButton($parentModel, $environment)
            ]
        );
    }
946154
public function setParentThing(ThingInterface $parentThing)
    {
        // If the new parent thing differs from the current one
        if ($this->parentThing !== $parentThing) {
            $context = clone $this;
            $context->parentThing = $parentThing;
            return $context;
        }

        return $this;
    }
95797
public function setMinSizeMessage($minSizeMessage)
    {
        if (!is_string($minSizeMessage)) {
            throw new \InvalidArgumentException('The attribute minSizeMessage on the class Attribute has to be string (' . gettype($minSizeMessage) . ('object' === gettype($minSizeMessage) ? ' ' . get_class($minSizeMessage) : '') . ' given).');
        }

        $this->minSizeMessage = $minSizeMessage;

        return $this;
    }
735569
public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int
    {
        // Check that relationship is `BelongsToMany`
        assert(call_user_func(function () use ($name): bool {
            $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name);
            $errMsg  = "Relationship `$name` of class `" . $this->getModelClass() .
                '` either is not `belongsToMany` or do not exist in the class.';
            $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY;

            assert($isOk, $errMsg);

            return $isOk;
        }));

        $builderHook = Closure::fromCallable([$this, 'builderOnCreateInBelongsToManyRelationship']);

        return $this->addInToManyRelationship($this->getConnection(), $parentId, $name, $childIds, $builderHook);
    }
339997
protected static function executeFields(ExecutionContext $context, ObjectType $parent, $source, $fields)
    {
        return self::executeFieldsSerially($context, $parent, $source, $fields);
    }
510875
private function create($messageClass, $message)
    {
        $interfaces = array_values(class_implements($messageClass, true));
        return new IncomingLogicalMessage($message, $messageClass, $interfaces);
    }
305475
protected function generateMessages(FileDescriptorProto $fileDescriptor, Traversable $messages, $parent = null)
    {
        $result = [];

        foreach ($messages as $message) {
            $entity        = $this->generateMessage($fileDescriptor, $message, $parent);
            $innerMessages = $message->getNestedTypeList();
            $innerEnums    = $message->getEnumTypeList();
            $innerParent   = ($parent !== null)
                ? $parent . '.' . $entity->getName()
                : $entity->getName();

            $result[] = $entity;

            if ($innerMessages) {
                $result = array_merge($result, $this->generateMessages($fileDescriptor, $innerMessages, $innerParent));
            }

            if ($innerEnums) {
                $result = array_merge($result, $this->generateEnums($fileDescriptor, $innerEnums, $innerParent));
            }
        }

        return $result;
    }