You are here

SophronGuesserServiceProvider.php in Sophron 8

File

sophron_guesser/src/SophronGuesserServiceProvider.php
View source
<?php

namespace Drupal\sophron_guesser;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Modifies the "file.mime_type.guesser.extension" service.
 */
class SophronGuesserServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {

    // Overrides "file.mime_type.guesser.extension" to use Sophron.
    $definition = $container
      ->getDefinition('file.mime_type.guesser.extension');
    $definition
      ->setClass(SophronMimeTypeGuesser::class)
      ->setArguments([
      new Reference('sophron.mime_map.manager'),
      new Reference('file_system'),
    ]);
  }

}

Classes

Namesort descending Description
SophronGuesserServiceProvider Modifies the "file.mime_type.guesser.extension" service.