Resolves strategy assuming it is the class name or FQN of an action strategy interface
implementation or an alias for one.

@param string $strategy
@return string|false     returns full class namespace if it was resolved succesfully
192029
protected function resolveStrategyClass($strategy)
    {
        if (empty($strategy)) {
            return false;
        }

        if ( ! str_contains($strategy, '.')) {
            $strategy = config($this->getAliasesBaseConfigKey() . $strategy, $strategy);
        }

        if (class_exists($strategy) && is_a($strategy, $this->getStrategyInterfaceClass(), true)) {
            return $strategy;
        }

        $strategy = $this->prefixStrategyNamespace($strategy);

        if (class_exists($strategy) && is_a($strategy, $this->getStrategyInterfaceClass(), true)) {
            return $strategy;
        }

        return false;
    }
45313
public function resolveNamespaceAlias($alias)
	{
		foreach ($this->namespaces as $namespace)
		{
			list($from, $to) = $namespace;

			if ($empty = empty($to) or strpos($alias, $to) === 0)
			{
				if ( ! $empty)
				{
					$alias = substr($alias, strlen($to) + 1);
				}

				$class = $from.'\\'.$alias;
				$this->resolving[] = $class;

				if ($this->objectExists($class, true))
				{
					array_pop($this->resolving);

					return $class;
				}
			}
		}

		return false;
	}
190968
public static function create($strategyName): StrategyInterface
    {
        if ($strategyName instanceof StrategyInterface) {
            return $strategyName;
        }

        if (\is_callable($strategyName)) {
            return new CallbackStrategy($strategyName);
        }

        if (\is_string($strategyName)) {
            $requiredInterface = StrategyInterface::class;
            $predefinedStrategy = '\\Elastica\\Connection\\Strategy\\'.$strategyName;

            if (\class_exists($predefinedStrategy) && \class_implements($predefinedStrategy, $requiredInterface)) {
                return new $predefinedStrategy();
            }

            if (\class_exists($strategyName) && \class_implements($strategyName, $requiredInterface)) {
                return new $strategyName();
            }
        }

        throw new InvalidException('Can\'t create strategy instance by given argument');
    }
1140602
private function getResolvedAction(MenuAction $action)
    {
        $actionId = $action->getId();
        if(!isset($this->resolvedActions[$actionId])){
            try{
                if($action->getContext() == '*'){
                    //we assume the star context is not permission aware
                    $this->resolvedActions[$actionId] = null;
                }  else {

                    $resolver = new ActionResolver($action->getUrl());
                    $resolvedAction = [
                        'id'         => $action->getId(),
                        'context'    => $action->getContext(),
                        'controller' => $resolver->getController(),
                        'action'     => $resolver->getAction(),
                    ];
                    $resolvedAction['required'] = array_keys(
                        ControllerHelper::getRequiredRights($resolvedAction['controller'], $resolvedAction['action'])
                    );

                    $this->resolvedActions[$actionId] = $resolvedAction;
                }
            } catch(\ResolverException $re) {
                $this->resolvedActions[$actionId] = null;
                \common_Logger::d('do not handle permissions for action : ' . $action->getName() . ' ' . $action->getUrl());
            } catch(\Exception $e){

                $this->resolvedActions[$actionId] = null;
                \common_Logger::d('do not handle permissions for action : ' . $action->getName() . ' ' . $action->getUrl());
            }
        }

        return $this->resolvedActions[$actionId];
    }
311944
public function resolve($name)
    {
        if (class_exists($name)) {
            return $name;
        }

        $name = static::normalise($name);

        $namespaces = clone $this->namespaces;

        $this->registerDefaultNamespace($namespaces);

        foreach (clone $namespaces as $ns) {
            $class = $ns . '\\' . $name;

            if (class_exists($class = $this->resolveClassAlias($class))) {
                if ($this->baseClass && !is_subclass_of($class, $this->baseClass)) {
                    throw new \DomainException(sprintf(
                        'Class: "%s" should be sub class of %s',
                        $class,
                        $this->baseClass
                    ));
                }

                return $class;
            }
        }

        throw new \DomainException(sprintf(
            'Can not find any classes with name: "%s" in package: "%s", namespaces: ( %s ).',
            $name,
            $this->package->getName(),
            implode(" |\n ", $namespaces->toArray())
        ));
    }
1244680
public function executeStrategyMethod($strategy, $method)
    {
        $strategy = $this->getStrategy($strategy);
        if (!$strategy) {
            return true;
        }

        return $this->explainer->displayBelow(function () use ($strategy, $method) {
            return $strategy->$method();
        });
    }
711010
public function getStrategy($strategy, $concrete = null, $options = [])
    {
        // Try to build the strategy
        $strategy = $this->builder->buildStrategy($strategy, $concrete);
        if (!$strategy || !$strategy->isExecutable()) {
            return;
        }

        // Configure strategy
        if ($options || $this->options) {
            $options = array_replace((array) $options, $strategy->getOptions(), $this->options);
            $strategy = $strategy->setOptions($options);
        }

        return $this->explainer->displayBelow(function () use ($strategy) {
            return $strategy->displayStatus();
        });
    }
273450
def resolve(name, *args, &block)
      strategy = @strategies.find do |strategy|
        valid?(strategy, name, *args, &block)
      end

      build(strategy, name, *args, &block)
    end
1033067
public function resolve(array $options)
    {
        $reflectedClassName = $this->reflected->getName();

        // We check if that constructor has been configured before and is in the registry
        if (!isset(self::$resolvers[$reflectedClassName])) {
            self::$resolvers[$reflectedClassName] = new OptionsResolver();

            $this->configureOptions(self::$resolvers[$reflectedClassName]);
        }

        return $this->hashToArgsArray(
            self::$resolvers[$reflectedClassName]->resolve($options)
        );
    }
302282
public static function isAtomic(string $strategy) : bool
    {
        return $strategy === ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET || $strategy === ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET_ARRAY;
    }
1002142
public function resolveAlias(string $alias)
    {
        if (isset($this->aliases[$alias]))
            return $this->aliases[$alias];

        if (empty($this->parent_scope))
            return null;

        return $this->parent_scope->resolveAlias($alias);
    }
1368133
public function orHavingConditions($strategy)
    {
        $instance = $this->havingStrategyInstance();

        $instance->havingStrategy()->orHavingConditions($strategy);

        return $instance;
    }
394445
public function resolveName(
        PurchasableInterface $purchasable,
        $separator = self::DEFAULT_SEPARATOR
    ) {
        foreach ($this->nameResolvers as $nameResolver) {
            $nameResolverNamespace = $nameResolver->getPurchasableNamespace();
            if ($purchasable instanceof $nameResolverNamespace) {
                return $nameResolver->resolveName(
                    $purchasable,
                    $separator
                );
            }
        }

        return false;
    }
1019670
public function resolve($alias)
	{
		// Skip recursive aliases if defined
		if (in_array($alias, $this->resolving))
		{
			return false;
		}

		// Set it as the resolving class for when
		// we want to block recursive resolving
		$this->resolving[] = $alias;

		// TODO: Find a nicer way of doing this. Array of closures perhaps?
		if ($this->cache->has($alias) and $class = $this->cache->get($alias))
		{
			// If we already have the alias in the cache don't bother resolving again
		}
		elseif ($class = $this->resolveAlias($alias))
		{
			// We've got a plain alias, now
			// we can skip the others as this
			// is the most powerful one.
		}
		elseif ($class = $this->resolveNamespaceAlias($alias))
		{
			// We've got a namespace alias, we
			// can skip pattern matching.
		}
		// Lastly we'll try to resolve it through
		// pattern matching. This is the most
		// expensive match type. Caching is
		// recommended if you use this.
		elseif ( ! $class = $this->resolvePatternAlias($alias))
		{
			return false;
		}

		// Remove the resolving class
		array_pop($this->resolving);

		if ( ! $this->objectExists($class))
		{
			return false;
		}

		// Create the actual alias
		class_alias($class, $alias);

		// Make sure our alias is stored in the cache for next time
		if ( ! $this->cache->has($alias))
		{
			$this->cache->set($alias, $class);
		}

		return true;
	}
93376
public function export($strategy)
    {
        // Check if the strategy is available and allowed to be used
        if ( ! $this->isExportStrategyAvailable($strategy)) {
            abort(403, "Not possible or allowed to perform export '{$strategy}'");
        }

        // Prepare the strategy instance
        $exporter = $this->getExportStrategyInstance($strategy);
        $filename = $this->getExportDownloadFilename($strategy, $exporter->extension());

        $this->checkListParents()
             ->checkActiveSort(false)
             ->checkScope(false)
             ->checkFilters()
             ->checkActivePage(false)
             ->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $download = $exporter->download($query, $filename);

        if (false === $download) {
            // @codeCoverageIgnoreStart
            abort(500, "Failed to export model listing for strategy '{$strategy}'");
            // @codeCoverageIgnoreEnd
        }

        event( new Events\ModelListExportedInCms($this->modelInformation->modelClass(), $strategy) );

        return $download;
    }
1079800
public function resolveNamespaceAlias(string $alias)
    {
        foreach ($this->namespaces as $namespace) {
            list($className, $aliasTo) = $namespace;

            if (false == strpos($alias, $aliasTo)) {
                if (!empty($aliasTo)) {
                    $alias = substr($alias, strlen($aliasTo) + 1);
                }

                return $this->getClassForNamespaceAlias($className.'\\'.$alias);
            }
        }

        return false;
    }
81133
public static function isList(?string $strategy) : bool
    {
        return $strategy !== ClassMetadata::STORAGE_STRATEGY_SET && $strategy !== ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET;
    }