| Conditions | 7 |
| Paths | 8 |
| Total Lines | 29 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function process(ContainerBuilder $container) |
||
| 23 | { |
||
| 24 | if ($container->hasDefinition('zicht_url.aliasing') === false) { |
||
| 25 | return; |
||
| 26 | } |
||
| 27 | |||
| 28 | $mappers = $container->findTaggedServiceIds('zicht_url.url_mapper'); |
||
| 29 | |||
| 30 | if (sizeof($mappers) === 0) { |
||
| 31 | return; |
||
| 32 | } |
||
| 33 | |||
| 34 | $aliasing = $container->getDefinition('zicht_url.aliasing'); |
||
| 35 | |||
| 36 | $sitemapIsAliased = false; |
||
| 37 | |||
| 38 | if ($container->getDefinition($container->getAlias('zicht_url.sitemap_provider'))->getClass() === AliasSitemapProvider::class) { |
||
| 39 | // aliasing is not needed for this implementation |
||
| 40 | $sitemapIsAliased = true; |
||
| 41 | } |
||
| 42 | |||
| 43 | foreach ($mappers as $serviceId => $info) { |
||
| 44 | $contentMapper = $container->getDefinition($serviceId); |
||
| 45 | if ($sitemapIsAliased && $contentMapper->getClass() === XmlMapper::class) { |
||
| 46 | // no need for aliasing the urls in the sitemapper, because it provides it's own aliasing. |
||
| 47 | // this is a performance optimization, since sitemaps can get extremely large. |
||
| 48 | continue; |
||
| 49 | } |
||
| 50 | $aliasing->addMethodCall('addMapper', array($contentMapper)); |
||
| 51 | } |
||
| 54 |