Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ValidatorPool.php
Go to the documentation of this file.
1 <?php
8 
12 
20 {
24  private $validators;
25 
30  public function __construct(
31  TMapFactory $tmapFactory,
32  array $validators = []
33  ) {
34  $this->validators = $tmapFactory->create(
35  [
36  'array' => $validators,
37  'type' => ValidatorInterface::class
38  ]
39  );
40  }
41 
49  public function get($code)
50  {
51  if (!isset($this->validators[$code])) {
52  throw new NotFoundException(__('The validator for the "%1" field doesn\'t exist.', $code));
53  }
54 
55  return $this->validators[$code];
56  }
57 }
__construct(TMapFactory $tmapFactory, array $validators=[])
__()
Definition: __.php:13
$code
Definition: info.phtml:12