package and depencies
This commit is contained in:
@@ -22,27 +22,11 @@ use Symfony\Component\DependencyInjection\Reference;
|
||||
*/
|
||||
class AddMimeTypeGuesserPass implements CompilerPassInterface
|
||||
{
|
||||
private $mimeTypesService;
|
||||
private $mimeTypeGuesserTag;
|
||||
|
||||
public function __construct(string $mimeTypesService = 'mime_types', string $mimeTypeGuesserTag = 'mime.mime_type_guesser')
|
||||
{
|
||||
if (0 < \func_num_args()) {
|
||||
trigger_deprecation('symfony/mime', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
|
||||
}
|
||||
|
||||
$this->mimeTypesService = $mimeTypesService;
|
||||
$this->mimeTypeGuesserTag = $mimeTypeGuesserTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if ($container->has($this->mimeTypesService)) {
|
||||
$definition = $container->findDefinition($this->mimeTypesService);
|
||||
foreach ($container->findTaggedServiceIds($this->mimeTypeGuesserTag, true) as $id => $attributes) {
|
||||
if ($container->has('mime_types')) {
|
||||
$definition = $container->findDefinition('mime_types');
|
||||
foreach ($container->findTaggedServiceIds('mime.mime_type_guesser', true) as $id => $attributes) {
|
||||
$definition->addMethodCall('registerGuesser', [new Reference($id)]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user