Pool.php 721 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\SalesRule\Model\Validator;
  7. /**
  8. * Class Pool collects custom validators for items before SalesRules are applied
  9. */
  10. class Pool
  11. {
  12. /**
  13. * @var array
  14. */
  15. protected $validators = [];
  16. /**
  17. * @param array $validators
  18. */
  19. public function __construct(array $validators = [])
  20. {
  21. $this->validators = $validators;
  22. }
  23. /**
  24. * Get Validators defined in di
  25. *
  26. * @param string $type
  27. * @return array
  28. */
  29. public function getValidators($type)
  30. {
  31. return isset($this->validators[$type]) ? $this->validators[$type] : [];
  32. }
  33. }