Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ResolverFactory.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
18  const DEFAULT_RESOLVER = \Magento\Setup\Module\I18n\Dictionary\Options\Resolver::class;
19 
23  protected $resolverClass;
24 
28  public function __construct($resolverClass = self::DEFAULT_RESOLVER)
29  {
30  $this->resolverClass = $resolverClass;
31  }
32 
39  public function create($directory, $withContext)
40  {
41  $resolver = new $this->resolverClass(new ComponentRegistrar(), $directory, $withContext);
42  if (!$resolver instanceof ResolverInterface) {
43  throw new \InvalidArgumentException($this->resolverClass . ' doesn\'t implement ResolverInterface');
44  }
45  return $resolver;
46  }
47 }