@param $strategy

@return bool|AuthStrategy
@throws UnknownStrategyException
14838
public function get($strategy = null)
    {
        if(!$strategy) {
            return $this->defaultStrategy;
        }

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

        if(!$strategy) {
            throw new UnknownStrategyException;
        }

        return $strategy;
    }
1213508
protected function _resolveStrategy($strategy)
    {
        $key = Security::salt();

        if (!$strategy) {
            $class = self::DEFAULT_STRATEGY;
            $strategy = new $class($key);
        }

        if (is_string($strategy) && class_exists($strategy)) {
            $strategy = new $strategy($key);
        }

        if (!($strategy instanceof StrategyInterface)) {
            throw new Exception('Invalid "strategy" configuration.');
        }

        return $strategy;
    }
21455
private void setStrategy(final ClassRealm realm, final Strategy strategy) {
        assert realm != null;
        assert strategy != null;

        try {
            Field field = realm.getClass().getDeclaredField("strategy");

            try {
                field.set(realm, strategy);
            }
            catch (IllegalAccessException ignore) {
                // try again
                field.setAccessible(true);

                try {
                    field.set(realm, strategy);
                }
                catch (IllegalAccessException e) {
                    throw new IllegalAccessError(e.getMessage());
                }
            }
        }
        catch (NoSuchFieldException e) {
            throw new Error(e);
        }
    }
1108492
public function orWhereConditions($strategy)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->orWhereConditions($strategy);

        return $instance;
    }
772977
public function attachErrorStrategy(AbstractErrorStrategy $strategy)
    {
        if ($strategy instanceof HtmlErrorStrategy) {
            $this->setDefaultErrorStrategy($strategy);

            return;
        }
        $this->strategies->attach($strategy);
    }
228555
public function getStrategy($id)
    {
        if (isset($this->strategies[$id])) {
            return $this->strategies[$id];
        }

        if (!isset($this->availableStrategies[$id])) {
            throw new InvalidArgumentException("Auth strategy '$id' does not exist or has not been registered.");
        }

        $class = $this->availableStrategies[$id];
        $strategy = new $class($this);
        $this->strategies[$id] = $strategy;

        return $strategy;
    }
731223
public function whereConditions($strategy)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->whereConditions($strategy);

        return $instance;
    }
1142205
public static function decode($strategy, $value)
	{
		switch ($strategy) {
			case 'explode':
				return explode(',', $value);
			case 'json':
				return json_decode($value);
			case 'serialize':
				return unserialize($value);
		}

		return $value;
	}
380699
protected function resolveStrategyClass($strategy)
    {
        if ( ! str_contains($strategy, '.')) {
            $strategy = config('cms-models.strategies.list.sort-aliases.' . $strategy, $strategy);
        }

        if (class_exists($strategy) && is_a($strategy, SortStrategyInterface::class, true)) {
            return $strategy;
        }

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

        if (class_exists($strategy) && is_a($strategy, SortStrategyInterface::class, true)) {
            return $strategy;
        }

        return false;
    }
467977
public static function matchesStrategy($strategy, Release $release1, Release $release2 = null)
    {
        if (in_array($strategy, array(self::MATCH_MAJOR_DIFFERENCE, self::MATCH_MINOR_DIFFERENCE, self::MATCH_ALWAYS)) === false) {
            throw new InvalidArgumentException(sprintf('The match strategy "%s" is invalid.', $strategy));
        }

        if ($strategy === self::MATCH_ALWAYS) {
            return true;
        }

        $match = false;
        $versionCategoryDifference = self::getDifference($release1, $release2);
        if ($strategy === self::MATCH_MAJOR_DIFFERENCE && $versionCategoryDifference === self::MAJOR) {
            $match = true;
        } elseif ($strategy === self::MATCH_MINOR_DIFFERENCE && in_array($versionCategoryDifference, array(self::MAJOR, self::MINOR))) {
            $match = true;
        }

        return $match;
    }
854564
protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive)
    {
        $wrapCase = $this->createWrapCase($caseSensitive);
        $valueParameter = $queryNameGenerator->generateParameterName($field);

        switch ($strategy) {
            case null:
            case self::STRATEGY_EXACT:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' = '.$wrapCase(':%s'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_PARTIAL:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(\'%%\', :%s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_START:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(:%s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_END:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(\'%%\', :%s)'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_WORD_START:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%1$s.%2$s').' LIKE '.$wrapCase('CONCAT(:%3$s, \'%%\')').' OR '.$wrapCase('%1$s.%2$s').' LIKE '.$wrapCase('CONCAT(\'%% \', :%3$s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            default:
                throw new InvalidArgumentException(sprintf('strategy %s does not exist.', $strategy));
        }
    }
1029804
protected function getStrategy()
	{
		if (is_null($this->strategy))
		{
			$this->strategy = new Strategy\DateTimeStrategy;
		}

		return $this->strategy;
	}
484927
public function fetch($strategy)
    {
        $method = 'fetch'.Inflector::classify(strtolower($strategy));

        if (!method_exists($this->association, $method)) {
            throw new InvalidArgumentException('Fetch ['.$strategy.'] does not exist');
        }

        $this->{$method}();

        return $this;
    }
364166
public function defaultSortingStrategy(string $strategy): ModelList
    {
        if (is_string($this->main['default_sort'])) {
            $this->main['default_sort'] = [ $this->main['default_sort'] ];
            $this->main['default_sort'][] = $strategy;

            return $this;
        }

        $this->main['default_sort'] = $strategy;

        return $this;
    }
427949
protected function prepareStrategies()
    {
        $strategy = new Strategy\AppConfigStrategy();
        $strategy->setObjectManager($this->objectManager);

        $this->addStrategy('AppConfig', $strategy);
    }
828727
public function deleteConditionStrategy(string $strategy, array $parameters = []): Model
    {
        if ( ! array_has($this->main, 'delete_condition')) {
            $this->main['delete_condition'] = '';
        }

        $this->main['delete_condition'] .= ($this->main['delete_condition'] ? '|' : '') . $strategy;

        if (count($parameters)) {

            $serializedParameters = implode(
                ',',
                array_map(
                    function ($value) {
                        return (string) $value;
                    },
                    $parameters
                )
            );

            $this->main['delete_condition'] .= ':' . $serializedParameters;
        }

        return $this;
    }
909797
public function getSessionStrategy(BrowserConfiguration $browser)
	{
		/*
		 * This logic creates separate strategy for:
		 * - each browser configuration in BrowserTestCase::$browsers (for isolated strategy)
		 * - each browser configuration in BrowserTestCase::$browsers for each test case class (for shared strategy)
		 */
		$strategy_type = $browser->getSessionStrategy();
		$strategy_hash = $browser->getSessionStrategyHash();

		if ( $strategy_hash !== $this->lastUsedSessionStrategyHash ) {
			$this->sessionStrategiesInUse[$strategy_hash] = $this->_sessionStrategyFactory->createStrategy(
				$strategy_type
			);
		}

		$this->lastUsedSessionStrategyHash = $strategy_hash;

		return $this->sessionStrategiesInUse[$strategy_hash];
	}