decorate example

->set('var_dumper.cloner', VarCloner::class)
            ->public()

        ->set('var_dumper.cli_dumper', CliDumper::class)
            ->args([
                null, // debug.dump_destination,                 param('kernel.charset'),
                0, // flags             ])

        ->set('var_dumper.contextualized_cli_dumper', ContextualizedDumper::class)
            ->decorate('var_dumper.cli_dumper')
            ->args([
                service('var_dumper.contextualized_cli_dumper.inner'),
                [
                    'source' => inline_service(SourceContextProvider::class)->args([
                        param('kernel.charset'),
                        param('kernel.project_dir'),
                        service('debug.file_link_formatter')->nullOnInvalid(),
                    ]),
                ],
            ])

        
$s->set('configurator_service_simple', 'ConfClass')
        ->args(['bar'])
        ->private();

    $s->set('configured_service_simple', 'stdClass')
        ->configurator([service('configurator_service_simple'), 'configureStdClass']);

    $s->set('decorated', 'stdClass');

    $s->set('decorator_service', 'stdClass')
        ->decorate('decorated');

    $s->set('decorator_service_with_name', 'stdClass')
        ->decorate('decorated', 'decorated.pif-pouf');

    $s->set('deprecated_service', 'stdClass')
        ->deprecate('vendor/package', '1.1', 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.');

    $s->set('new_factory', 'FactoryClass')
        ->property('foo', 'bar')
        ->private();

    
use Bar\FooClass;
use stdClass;
use Symfony\Component\DependencyInjection\Tests\Fixtures\StdClassDecorator;

return function DContainerConfigurator $c) {
    $s = $c->services()->defaults()->public();

    $s->set('decorated', stdClass::class);

    $s->set(null, StdClassDecorator::class)
        ->decorate('decorated', 'decorator42')
        ->args([service('decorator42')]);

    $s->set('listener_aggregator', FooClass::class)->public()->args([tagged_iterator('listener')]);

    $s->set(null, stdClass::class)->tag('listener');
};
'session_collector' => service('data_collector.request.session_collector')->ignoreOnInvalid(),
                ]),
                param('kernel.debug'),
                param('session.storage.options'),
            ])
            ->tag('kernel.event_subscriber')
            ->tag('kernel.reset', ['method' => 'reset'])

        ->set('session.marshaller', IdentityMarshaller::class)

        ->set('session.marshalling_handler', MarshallingSessionHandler::class)
            ->decorate('session.handler')
            ->args([
                service('session.marshalling_handler.inner'),
                service('session.marshaller'),
            ])
    ;
};
->args([
                service('asset_mapper.public_assets_path_resolver'),
                service('asset_mapper_compiler'),
            ])

        ->set('asset_mapper.cached_mapped_asset_factory', CachedMappedAssetFactory::class)
            ->args([
                service('.inner'),
                param('kernel.cache_dir').'/asset_mapper',
                param('kernel.debug'),
            ])
            ->decorate('asset_mapper.mapped_asset_factory')

        ->set('asset_mapper.repository', AssetMapperRepository::class)
            ->args([
                abstract_arg('array of asset mapper paths'),
                param('kernel.project_dir'),
                abstract_arg('array of excluded path patterns'),
            ])

        ->set('asset_mapper.public_assets_path_resolver', PublicAssetsPathResolver::class)
            ->args([
                param('kernel.project_dir'),
                
->set('http_client.abstract_retry_strategy', GenericRetryStrategy::class)
            ->abstract()
            ->args([
                abstract_arg('http codes'),
                abstract_arg('delay ms'),
                abstract_arg('multiplier'),
                abstract_arg('max delay ms'),
                abstract_arg('jitter'),
            ])

        ->set('http_client.uri_template', UriTemplateHttpClient::class)
            ->decorate('http_client', null, 7) // Between TraceableHttpClient (5) and RetryableHttpClient (10)             ->args([
                service('.inner'),
                service('http_client.uri_template_expander')->nullOnInvalid(),
                abstract_arg('default vars'),
            ])

        ->set('http_client.uri_template_expander.guzzle', \Closure::class)
            ->factory([\Closure::class, 'fromCallable'])
            ->args([
                [\GuzzleHttp\UriTemplate\UriTemplate::class, 'expand'],
            ])

        
namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\HttpKernel\Controller\ArgumentResolver\NotTaggedControllerValueResolver;
use Symfony\Component\HttpKernel\Controller\TraceableArgumentResolver;
use Symfony\Component\HttpKernel\Controller\TraceableControllerResolver;
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('debug.event_dispatcher', TraceableEventDispatcher::class)
            ->decorate('event_dispatcher')
            ->args([
                service('debug.event_dispatcher.inner'),
                service('debug.stopwatch'),
                service('logger')->nullOnInvalid(),
                service('request_stack')->nullOnInvalid(),
            ])
            ->tag('monolog.logger', ['channel' => 'event'])
            ->tag('kernel.reset', ['method' => 'reset'])

        ->set('debug.controller_resolver', TraceableControllerResolver::class)
            ->decorate('controller_resolver')
            


namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener;
use Symfony\Bundle\SecurityBundle\EventListener\VoteListener;
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('debug.security.access.decision_manager', TraceableAccessDecisionManager::class)
            ->decorate('security.access.decision_manager')
            ->args([
                service('debug.security.access.decision_manager.inner'),
            ])

        ->set('debug.security.voter.vote_listener', VoteListener::class)
            ->args([
                service('debug.security.access.decision_manager'),
            ])
            ->tag('kernel.event_subscriber')

        ->set('debug.security.firewall', TraceableFirewallListener::class)
            
abstract_arg('interval format, set in TwigExtension'),
                abstract_arg('timezone, set in TwigExtension'),
                abstract_arg('decimals, set in TwigExtension'),
                abstract_arg('decimal point, set in TwigExtension'),
                abstract_arg('thousands separator, set in TwigExtension'),
            ])

        ->set('twig.runtime_loader', ContainerRuntimeLoader::class)
            ->args([abstract_arg('runtime locator')])

        ->set('twig.error_renderer.html', TwigErrorRenderer::class)
            ->decorate('error_renderer.html')
            ->args([
                service('twig'),
                service('twig.error_renderer.html.inner'),
                inline_service('bool')
                    ->factory([TwigErrorRenderer::class, 'isDebug'])
                    ->args([service('request_stack')param('kernel.debug')]),
            ])

        ->set('twig.runtime.serializer', SerializerRuntime::class)
            ->args([service('serializer')])

        
// Cache         ->set('serializer.mapping.cache_warmer', SerializerCacheWarmer::class)
            ->args([abstract_arg('The serializer metadata loaders')param('serializer.mapping.cache.file')])
            ->tag('kernel.cache_warmer')

        ->set('serializer.mapping.cache.symfony', CacheItemPoolInterface::class)
            ->factory([PhpArrayAdapter::class, 'create'])
            ->args([param('serializer.mapping.cache.file')service('cache.serializer')])

        ->set('serializer.mapping.cache_class_metadata_factory', CacheClassMetadataFactory::class)
            ->decorate('serializer.mapping.class_metadata_factory')
            ->args([
                service('serializer.mapping.cache_class_metadata_factory.inner'),
                service('serializer.mapping.cache.symfony'),
            ])

        // Encoders         ->set('serializer.encoder.xml', XmlEncoder::class)
            ->tag('serializer.encoder')

        ->set('serializer.encoder.json', JsonEncoder::class)
            ->args([null, null])
            


namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Validator\DataCollector\ValidatorDataCollector;
use Symfony\Component\Validator\Validator\TraceableValidator;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('debug.validator', TraceableValidator::class)
            ->decorate('validator', null, 255)
            ->args([
                service('debug.validator.inner'),
            ])
            ->tag('kernel.reset', [
                'method' => 'reset',
            ])

        ->set('data_collector.validator', ValidatorDataCollector::class)
            ->args([
                service('debug.validator'),
            ])
            

    protected function decorateOutput(string $html): string
    {
        $decorators = \config(ViewConfig::class)->decorators;

        foreach ($decorators as $decorator) {
            if (is_subclass_of($decorator, ViewDecoratorInterface::class)) {
                throw ViewException::forInvalidDecorator($decorator);
            }

            $html = $decorator::decorate($html);
        }

        return $html;
    }
}
return function DContainerConfigurator $c) {
    $c->services()
        ->set('bar', 'Class1')->public()
        ->set(BarService::class)
            ->public()
            ->abstract(true)
            ->lazy()
        ->set('foo')
            ->parent(BarService::class)
            ->public()
            ->decorate('bar', 'b', 1)
            ->args([service('b')])
            ->class('Class2')
            ->file('file.php')
            ->parent('bar')
            ->parent(BarService::class)
    ;
};
->set('property_info', PropertyInfoExtractor::class)
            ->args([[][][][][]])

        ->alias(PropertyAccessExtractorInterface::class, 'property_info')
        ->alias(PropertyDescriptionExtractorInterface::class, 'property_info')
        ->alias(PropertyInfoExtractorInterface::class, 'property_info')
        ->alias(PropertyTypeExtractorInterface::class, 'property_info')
        ->alias(PropertyListExtractorInterface::class, 'property_info')
        ->alias(PropertyInitializableExtractorInterface::class, 'property_info')

        ->set('property_info.cache', PropertyInfoCacheExtractor::class)
            ->decorate('property_info')
            ->args([service('property_info.cache.inner')service('cache.property_info')])

        // Extractor         ->set('property_info.reflection_extractor', ReflectionExtractor::class)
            ->tag('property_info.list_extractor', ['priority' => -1000])
            ->tag('property_info.type_extractor', ['priority' => -1002])
            ->tag('property_info.access_extractor', ['priority' => -1000])
            ->tag('property_info.initializable_extractor', ['priority' => -1000])

        ->alias(PropertyReadInfoExtractorInterface::class, 'property_info.reflection_extractor')
        ->alias(PropertyWriteInfoExtractorInterface::class, 'property_info.reflection_extractor')
    ;


namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Component\Serializer\DataCollector\SerializerDataCollector;
use Symfony\Component\Serializer\Debug\TraceableSerializer;

return static function DContainerConfigurator $container) {
    $container->services()
        ->set('debug.serializer', TraceableSerializer::class)
            ->decorate('serializer')
            ->args([
                service('debug.serializer.inner'),
                service('serializer.data_collector'),
            ])

        ->set('serializer.data_collector', SerializerDataCollector::class)
            ->tag('data_collector', [
                'template' => '@WebProfiler/Collector/serializer.html.twig',
                'id' => 'serializer',
            ])
    ;
};
Home | Imprint | This part of the site doesn't use cookies.