class NumberFormatRepository in Price 8
Same name and namespace in other branches
- 3.x src/Repository/NumberFormatRepository.php \Drupal\price\Repository\NumberFormatRepository
- 2.0.x src/Repository/NumberFormatRepository.php \Drupal\price\Repository\NumberFormatRepository
- 2.x src/Repository/NumberFormatRepository.php \Drupal\price\Repository\NumberFormatRepository
- 3.0.x src/Repository/NumberFormatRepository.php \Drupal\price\Repository\NumberFormatRepository
Defines the number format repository.
Number formats are stored inside the parent class, which is extended here to allow the definitions to be altered via events.
Hierarchy
- class \Drupal\price\Repository\NumberFormatRepository extends \CommerceGuys\Intl\NumberFormat\NumberFormatRepository implements \CommerceGuys\Intl\NumberFormat\NumberFormatRepositoryInterface
Expanded class hierarchy of NumberFormatRepository
1 string reference to 'NumberFormatRepository'
1 service uses NumberFormatRepository
File
- src/
Repository/ NumberFormatRepository.php, line 17
Namespace
Drupal\price\RepositoryView source
class NumberFormatRepository extends ExternalNumberFormatRepository implements NumberFormatRepositoryInterface {
/**
* The event dispatcher.
*
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
*/
protected $eventDispatcher;
/**
* Creates a NumberFormatRepository instance.
*
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher.
*/
public function __construct(EventDispatcherInterface $event_dispatcher) {
parent::__construct();
$this->eventDispatcher = $event_dispatcher;
}
/**
* {@inheritdoc}
*/
protected function processDefinition($locale, array $definition) {
$definition = parent::processDefinition($locale, $definition);
// Let the definition be altered.
$event = new NumberFormatDefinitionEvent($definition);
$this->eventDispatcher
->dispatch(PriceEvents::NUMBER_FORMAT, $event);
$definition = $event
->getDefinition();
return $definition;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NumberFormatRepository:: |
protected | property | The event dispatcher. | |
NumberFormatRepository:: |
protected | function | ||
NumberFormatRepository:: |
public | function | Creates a NumberFormatRepository instance. |