objectManager = $objectManager; $this->scopeState = $scopeState; $this->states = $states; } /** * Creates class instance with specified parameters * * @param string $state * @return \Magento\Framework\Search\Request\IndexScopeResolverInterface * @throws UnknownStateException */ private function create($state) { if (!array_key_exists($state, $this->states)) { throw new UnknownStateException(__("Requested resolver for unknown indexer state: $state")); } return $this->objectManager->create($this->states[$state]); } /** * @inheritdoc */ public function resolve($index, array $dimensions) { return $this->create($this->scopeState->getState())->resolve($index, $dimensions); } }