src/DependencyInjection/EightPointsGuzzleExtension.php
protected function defineRequestTimeMiddleware(ContainerBuilder $container, Definition $handler, string $clientName)
    {
        $requestTimeMiddlewareDefinitionName = sprintf('eight_points_guzzle.middleware.request_time.%s', $clientName);
        $requestTimeMiddlewareDefinition = new Definition('%eight_points_guzzle.middleware.request_time.class%');
        $requestTimeMiddlewareDefinition->addArgument(new Reference('eight_points_guzzle.logger'));
        $requestTimeMiddlewareDefinition->addArgument(new Reference('eight_points_guzzle.data_collector'));
        $requestTimeMiddlewareDefinition->setPublic(true);
        $container->setDefinition($requestTimeMiddlewareDefinitionName, $requestTimeMiddlewareDefinition);

        $requestTimeExpression = new Expression(sprintf("service('%s')", $requestTimeMiddlewareDefinitionName));
        $handler->addMethodCall('after', ['log', $requestTimeExpression, 'request_time']);
    }
protected function defineRequestTimeMiddleware(ContainerBuilder $container, Definition $handler, string $clientName)
    {
        $requestTimeMiddlewareDefinitionName = sprintf('eight_points_guzzle.middleware.request_time.%s', $clientName);
        $requestTimeMiddlewareDefinition = new Definition('%eight_points_guzzle.middleware.request_time.class%');
        $requestTimeMiddlewareDefinition->addArgument(new Reference('eight_points_guzzle.logger'));
        $requestTimeMiddlewareDefinition->addArgument(new Reference('eight_points_guzzle.data_collector'));
        $requestTimeMiddlewareDefinition->setPublic(true);
        $container->setDefinition($requestTimeMiddlewareDefinitionName, $requestTimeMiddlewareDefinition);

        $requestTimeExpression = new Expression(sprintf("service('%s')", $requestTimeMiddlewareDefinitionName));
        $handler->addMethodCall('after', ['log', $requestTimeExpression, 'request_time']);
    }
protected function defineRequestTimeMiddleware ( ContainerBuilder $ container , Definition $ handler , string $ clientName ) { $ requestTimeMiddlewareDefinitionName = sprintf ( 'eight_points_guzzle.middleware.request_time.%s' , $ clientName ) ; $ requestTimeMiddlewareDefinition = new Definition ( '%eight_points_guzzle.middleware.request_time.class%' ) ; $ requestTimeMiddlewareDefinition -> addArgument ( new Reference ( 'eight_points_guzzle.logger' ) ) ; $ requestTimeMiddlewareDefinition -> addArgument ( new Reference ( 'eight_points_guzzle.data_collector' ) ) ; $ requestTimeMiddlewareDefinition -> setPublic ( true ) ; $ container -> setDefinition ( $ requestTimeMiddlewareDefinitionName , $ requestTimeMiddlewareDefinition ) ; $ requestTimeExpression = new Expression ( sprintf ( "service('%s')" , $ requestTimeMiddlewareDefinitionName ) ) ; $ handler -> addMethodCall ( 'after' , [ 'log' , $ requestTimeExpression , 'request_time' ] ) ; }
Define Request Time Middleware

@param \Symfony\Component\DependencyInjection\ContainerBuilder $container
@param \Symfony\Component\DependencyInjection\Definition $handler
@param string $clientName

@return void
Define Request Time Middleware