src/DependencyInjection/Compiler/RpcMethodPass.php
public function process(ContainerBuilder $container)
    {
        $taggedMethods = $container->findTaggedServiceIds(MethodInterface::class);

        // Collect meta data from methods tags
        foreach ($taggedMethods as $methodId => $attrs) {
            foreach ($attrs as $attr) {
                $cacheForMapperId = $attr['mapperId'];

                if (true === isset($this->methodMeta[$cacheForMapperId][$methodId])) {
                    continue;
                }

                $this->methodMeta[$cacheForMapperId][$methodId] = $this->loadClassMetadata(
                    $container->getReflectionClass($methodId)
                );
            }
        }

        $taggedMappers = $container->findTaggedServiceIds(MapperInterface::class);

        $methodsMetaData = [];
        // Inject method meta data to mapper
        foreach ($taggedMappers as $mapperId => $mapperAttr) {
            if (false === isset($this->methodMeta[$mapperId])) {
                continue; // Method not exists
            }

            $methodsMeta = $this->methodMeta[$mapperId];

            foreach ($methodsMeta as $methodId => $meta) {
                if (null === $meta) {
                    continue;
                }

                $methodsMetaData[$mapperId][$meta['method']] = [
                    $methodId,
                    $meta['executeMethod'],
                    $meta['params'],
                    $meta['cache'],
                    $meta['roles'],
                    $meta['cache'],
                ];
            }
        }

        // Inject method meta data to mapper
        foreach ($methodsMetaData as $mapperId => $methods) {
            $definition = $container->getDefinition($mapperId);
            $definition->addMethodCall('addMethods', [$methods]);
        }
    }
public function process(ContainerBuilder $container)
    {
        $taggedMethods = $container->findTaggedServiceIds(MethodInterface::class);

        // Collect meta data from methods tags
        foreach ($taggedMethods as $methodId => $attrs) {
            foreach ($attrs as $attr) {
                $cacheForMapperId = $attr['mapperId'];

                if (true === isset($this->methodMeta[$cacheForMapperId][$methodId])) {
                    continue;
                }

                $this->methodMeta[$cacheForMapperId][$methodId] = $this->loadClassMetadata(
                    $container->getReflectionClass($methodId)
                );
            }
        }

        $taggedMappers = $container->findTaggedServiceIds(MapperInterface::class);

        $methodsMetaData = [];
        // Inject method meta data to mapper
        foreach ($taggedMappers as $mapperId => $mapperAttr) {
            if (false === isset($this->methodMeta[$mapperId])) {
                continue; // Method not exists
            }

            $methodsMeta = $this->methodMeta[$mapperId];

            foreach ($methodsMeta as $methodId => $meta) {
                if (null === $meta) {
                    continue;
                }

                $methodsMetaData[$mapperId][$meta['method']] = [
                    $methodId,
                    $meta['executeMethod'],
                    $meta['params'],
                    $meta['cache'],
                    $meta['roles'],
                    $meta['cache'],
                ];
            }
        }

        // Inject method meta data to mapper
        foreach ($methodsMetaData as $mapperId => $methods) {
            $definition = $container->getDefinition($mapperId);
            $definition->addMethodCall('addMethods', [$methods]);
        }
    }
@param ContainerBuilder $container

@throws InvalidMappingException
@throws \ReflectionException