2727use Symfony \Component \DependencyInjection \ContainerBuilder ;
2828use Symfony \Component \DependencyInjection \Definition ;
2929use Symfony \Component \DependencyInjection \Extension \Extension ;
30- use Symfony \Component \DependencyInjection \Loader \XmlFileLoader ;
30+ use Symfony \Component \DependencyInjection \Loader \PhpFileLoader ;
3131use Symfony \Component \DependencyInjection \Reference ;
3232use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
3333use Twig \TwigFunction ;
@@ -44,15 +44,15 @@ public function load(array $configs, ContainerBuilder $container): void
4444 $ configuration = $ this ->getConfiguration ($ configs , $ container );
4545 $ config = $ this ->processConfiguration ($ configuration , $ configs );
4646
47- $ loader = new XmlFileLoader ($ container , new FileLocator (__DIR__ .'/../Resources/config ' ));
48- $ loader ->load ('matcher.xml ' );
47+ $ loader = new PhpFileLoader ($ container , new FileLocator (__DIR__ .'/../Resources/config ' ));
48+ $ loader ->load ('matcher.php ' );
4949
5050 if ($ config ['debug ' ]['enabled ' ] || (!empty ($ config ['cache_control ' ]))) {
5151 $ debugHeader = $ config ['debug ' ]['enabled ' ] ? $ config ['debug ' ]['header ' ] : false ;
5252 $ ttlHeader = $ config ['cache_control ' ]['ttl_header ' ] ?? CacheControlListener::DEFAULT_TTL_HEADER_NAME ;
5353 $ container ->setParameter ('fos_http_cache.debug_header ' , $ debugHeader );
5454 $ container ->setParameter ('fos_http_cache.ttl_header ' , $ ttlHeader );
55- $ loader ->load ('cache_control_listener.xml ' );
55+ $ loader ->load ('cache_control_listener.php ' );
5656 }
5757
5858 $ this ->loadCacheable ($ container , $ config ['cacheable ' ]);
@@ -99,9 +99,9 @@ public function load(array $configs, ContainerBuilder $container): void
9999 $ generateUrlType = $ config ['cache_manager ' ]['generate_url_type ' ];
100100 }
101101 $ container ->setParameter ('fos_http_cache.cache_manager.generate_url_type ' , $ generateUrlType );
102- $ loader ->load ('cache_manager.xml ' );
102+ $ loader ->load ('cache_manager.php ' );
103103 if (class_exists (Application::class)) {
104- $ loader ->load ('cache_manager_commands.xml ' );
104+ $ loader ->load ('cache_manager_commands.php ' );
105105 }
106106 }
107107
@@ -117,7 +117,7 @@ public function load(array $configs, ContainerBuilder $container): void
117117 }
118118
119119 if ($ config ['invalidation ' ]['enabled ' ]) {
120- $ loader ->load ('invalidation_listener.xml ' );
120+ $ loader ->load ('invalidation_listener.php ' );
121121
122122 if (!empty ($ config ['invalidation ' ]['expression_language ' ])) {
123123 $ container ->setAlias (
@@ -139,10 +139,10 @@ public function load(array $configs, ContainerBuilder $container): void
139139 unset($ config ['flash_message ' ]['enabled ' ]);
140140 $ container ->setParameter ('fos_http_cache.event_listener.flash_message.options ' , $ config ['flash_message ' ]);
141141
142- $ loader ->load ('flash_message.xml ' );
142+ $ loader ->load ('flash_message.php ' );
143143 }
144144
145- $ loader ->load ('attributes.xml ' );
145+ $ loader ->load ('attributes.php ' );
146146 }
147147
148148 private function loadCacheable (ContainerBuilder $ container , array $ config ): void
@@ -279,15 +279,15 @@ private function parseResponseMatcher(ContainerBuilder $container, array $config
279279 return new Reference ('fos_http_cache.response_matcher.cacheable ' );
280280 }
281281
282- private function loadUserContext (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
282+ private function loadUserContext (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
283283 {
284284 $ configuredUserIdentifierHeaders = array_map ('strtolower ' , $ config ['user_identifier_headers ' ]);
285285 $ completeUserIdentifierHeaders = $ configuredUserIdentifierHeaders ;
286286 if (false !== $ config ['session_name_prefix ' ] && !in_array ('cookie ' , $ completeUserIdentifierHeaders )) {
287287 $ completeUserIdentifierHeaders [] = 'cookie ' ;
288288 }
289289
290- $ loader ->load ('user_context.xml ' );
290+ $ loader ->load ('user_context.php ' );
291291
292292 $ container ->getDefinition ('fos_http_cache.user_context.request_matcher ' )
293293 ->replaceArgument (0 , $ config ['match ' ]['accept ' ])
@@ -326,7 +326,7 @@ private function loadUserContext(ContainerBuilder $container, XmlFileLoader $loa
326326 }
327327 }
328328
329- private function loadProxyClient (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
329+ private function loadProxyClient (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
330330 {
331331 if (isset ($ config ['varnish ' ])) {
332332 $ this ->loadVarnish ($ container , $ loader , $ config ['varnish ' ]);
@@ -347,7 +347,7 @@ private function loadProxyClient(ContainerBuilder $container, XmlFileLoader $loa
347347 $ this ->loadFastly ($ container , $ loader , $ config ['fastly ' ]);
348348 }
349349 if (isset ($ config ['noop ' ])) {
350- $ loader ->load ('noop.xml ' );
350+ $ loader ->load ('noop.php ' );
351351 }
352352
353353 $ container ->setAlias (
@@ -410,7 +410,7 @@ private function createHttpDispatcherDefinition(ContainerBuilder $container, arr
410410 $ container ->setDefinition ($ serviceName , $ definition );
411411 }
412412
413- private function loadVarnish (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
413+ private function loadVarnish (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
414414 {
415415 $ this ->createHttpDispatcherDefinition ($ container , $ config ['http ' ], 'fos_http_cache.proxy_client.varnish.http_dispatcher ' );
416416 $ options = [
@@ -426,7 +426,7 @@ private function loadVarnish(ContainerBuilder $container, XmlFileLoader $loader,
426426 }
427427 $ container ->setParameter ('fos_http_cache.proxy_client.varnish.options ' , $ options );
428428
429- $ loader ->load ('varnish.xml ' );
429+ $ loader ->load ('varnish.php ' );
430430
431431 $ requestFactory = isset ($ config ['http ' ]['request_factory ' ])
432432 ? new Reference ($ config ['http ' ]['request_factory ' ])
@@ -441,13 +441,13 @@ private function loadVarnish(ContainerBuilder $container, XmlFileLoader $loader,
441441 ->replaceArgument (3 , $ streamFactory );
442442 }
443443
444- private function loadNginx (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
444+ private function loadNginx (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
445445 {
446446 $ this ->createHttpDispatcherDefinition ($ container , $ config ['http ' ], 'fos_http_cache.proxy_client.nginx.http_dispatcher ' );
447447 $ container ->setParameter ('fos_http_cache.proxy_client.nginx.options ' , [
448448 'purge_location ' => $ config ['purge_location ' ],
449449 ]);
450- $ loader ->load ('nginx.xml ' );
450+ $ loader ->load ('nginx.php ' );
451451
452452 $ requestFactory = isset ($ config ['http ' ]['request_factory ' ])
453453 ? new Reference ($ config ['http ' ]['request_factory ' ])
@@ -462,7 +462,7 @@ private function loadNginx(ContainerBuilder $container, XmlFileLoader $loader, a
462462 ->replaceArgument (3 , $ streamFactory );
463463 }
464464
465- private function loadSymfony (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
465+ private function loadSymfony (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
466466 {
467467 $ serviceName = 'fos_http_cache.proxy_client.symfony.http_dispatcher ' ;
468468
@@ -485,7 +485,7 @@ private function loadSymfony(ContainerBuilder $container, XmlFileLoader $loader,
485485 }
486486 $ container ->setParameter ('fos_http_cache.proxy_client.symfony.options ' , $ options );
487487
488- $ loader ->load ('symfony.xml ' );
488+ $ loader ->load ('symfony.php ' );
489489
490490 $ requestFactory = isset ($ config ['http ' ]['request_factory ' ])
491491 ? new Reference ($ config ['http ' ]['request_factory ' ])
@@ -500,7 +500,7 @@ private function loadSymfony(ContainerBuilder $container, XmlFileLoader $loader,
500500 ->replaceArgument (3 , $ streamFactory );
501501 }
502502
503- private function loadCloudflare (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
503+ private function loadCloudflare (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
504504 {
505505 $ this ->createHttpDispatcherDefinition ($ container , $ config ['http ' ], 'fos_http_cache.proxy_client.cloudflare.http_dispatcher ' );
506506 $ options = [
@@ -510,7 +510,7 @@ private function loadCloudflare(ContainerBuilder $container, XmlFileLoader $load
510510
511511 $ container ->setParameter ('fos_http_cache.proxy_client.cloudflare.options ' , $ options );
512512
513- $ loader ->load ('cloudflare.xml ' );
513+ $ loader ->load ('cloudflare.php ' );
514514
515515 $ requestFactory = isset ($ config ['http ' ]['request_factory ' ])
516516 ? new Reference ($ config ['http ' ]['request_factory ' ])
@@ -525,7 +525,7 @@ private function loadCloudflare(ContainerBuilder $container, XmlFileLoader $load
525525 ->replaceArgument (3 , $ streamFactory );
526526 }
527527
528- private function loadCloudfront (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
528+ private function loadCloudfront (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
529529 {
530530 if (null !== $ config ['client ' ]) {
531531 $ container ->setAlias (
@@ -543,10 +543,10 @@ private function loadCloudfront(ContainerBuilder $container, XmlFileLoader $load
543543 'distribution_id ' => $ config ['distribution_id ' ],
544544 ]);
545545
546- $ loader ->load ('cloudfront.xml ' );
546+ $ loader ->load ('cloudfront.php ' );
547547 }
548548
549- private function loadFastly (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
549+ private function loadFastly (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
550550 {
551551 $ this ->createHttpDispatcherDefinition ($ container , $ config ['http ' ], 'fos_http_cache.proxy_client.fastly.http_dispatcher ' );
552552
@@ -558,7 +558,7 @@ private function loadFastly(ContainerBuilder $container, XmlFileLoader $loader,
558558
559559 $ container ->setParameter ('fos_http_cache.proxy_client.fastly.options ' , $ options );
560560
561- $ loader ->load ('fastly.xml ' );
561+ $ loader ->load ('fastly.php ' );
562562
563563 $ requestFactory = isset ($ config ['http ' ]['request_factory ' ])
564564 ? new Reference ($ config ['http ' ]['request_factory ' ])
@@ -578,7 +578,7 @@ private function loadFastly(ContainerBuilder $container, XmlFileLoader $loader,
578578 * @param string $client Name of the client used with the cache manager,
579579 * "custom" when a custom client is used
580580 */
581- private function loadCacheTagging (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config , string $ client ): void
581+ private function loadCacheTagging (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config , string $ client ): void
582582 {
583583 if ('auto ' === $ config ['enabled ' ] && !in_array ($ client , ['varnish ' , 'symfony ' , 'cloudflare ' , 'fastly ' ])) {
584584 return ;
@@ -591,12 +591,12 @@ private function loadCacheTagging(ContainerBuilder $container, XmlFileLoader $lo
591591 $ container ->setParameter ('fos_http_cache.tag_handler.separator ' , $ config ['separator ' ]);
592592 $ container ->setParameter ('fos_http_cache.tag_handler.strict ' , $ config ['strict ' ]);
593593
594- $ loader ->load ('cache_tagging.xml ' );
594+ $ loader ->load ('cache_tagging.php ' );
595595 if (class_exists (TwigFunction::class)) {
596- $ loader ->load ('cache_tagging_twig.xml ' );
596+ $ loader ->load ('cache_tagging_twig.php ' );
597597 }
598598 if (class_exists (Application::class)) {
599- $ loader ->load ('cache_tagging_commands.xml ' );
599+ $ loader ->load ('cache_tagging_commands.php ' );
600600 }
601601
602602 if (!empty ($ config ['expression_language ' ])) {
@@ -618,7 +618,7 @@ private function loadCacheTagging(ContainerBuilder $container, XmlFileLoader $lo
618618 }
619619 }
620620
621- private function loadTest (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
621+ private function loadTest (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
622622 {
623623 $ container ->setParameter ('fos_http_cache.test.cache_header ' , $ config ['cache_header ' ]);
624624
@@ -627,7 +627,7 @@ private function loadTest(ContainerBuilder $container, XmlFileLoader $loader, ar
627627 }
628628 }
629629
630- private function loadProxyServer (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
630+ private function loadProxyServer (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
631631 {
632632 if (isset ($ config ['varnish ' ])) {
633633 $ this ->loadVarnishProxyServer ($ container , $ loader , $ config ['varnish ' ]);
@@ -643,9 +643,9 @@ private function loadProxyServer(ContainerBuilder $container, XmlFileLoader $loa
643643 );
644644 }
645645
646- private function loadVarnishProxyServer (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
646+ private function loadVarnishProxyServer (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
647647 {
648- $ loader ->load ('varnish_proxy.xml ' );
648+ $ loader ->load ('varnish_proxy.php ' );
649649 foreach ($ config as $ key => $ value ) {
650650 $ container ->setParameter (
651651 'fos_http_cache.test.proxy_server.varnish. ' .$ key ,
@@ -654,9 +654,9 @@ private function loadVarnishProxyServer(ContainerBuilder $container, XmlFileLoad
654654 }
655655 }
656656
657- private function loadNginxProxyServer (ContainerBuilder $ container , XmlFileLoader $ loader , array $ config ): void
657+ private function loadNginxProxyServer (ContainerBuilder $ container , PhpFileLoader $ loader , array $ config ): void
658658 {
659- $ loader ->load ('nginx_proxy.xml ' );
659+ $ loader ->load ('nginx_proxy.php ' );
660660 foreach ($ config as $ key => $ value ) {
661661 $ container ->setParameter (
662662 'fos_http_cache.test.proxy_server.nginx. ' .$ key ,
0 commit comments