You are here

class CommercePriceServiceProvider in Commerce Core 8.2

Swaps the default physical.number_formatter service class.

Hierarchy

Expanded class hierarchy of CommercePriceServiceProvider

File

modules/price/src/CommercePriceServiceProvider.php, line 12

Namespace

Drupal\commerce_price
View source
class CommercePriceServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    if ($container
      ->hasDefinition('physical.number_formatter')) {
      $container
        ->getDefinition('physical.number_formatter')
        ->setClass(PhysicalNumberFormatter::class)
        ->setArguments([
        new Reference('commerce_price.number_format_repository'),
        new Reference('commerce.current_locale'),
      ]);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommercePriceServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceProviderBase::alter
ServiceProviderBase::register public function Registers services to the container. Overrides ServiceProviderInterface::register 1