Returns strategy instance.

@param string $strategy  strategy class or alias
@param array  $options   options for the strategy
@return VariantStrategyInterface
436125
public function make($strategy, array $options = [])
    {
        $instance = $this->instantiateClass(
            $this->resolveStrategyClassName($strategy)
        );

        if ( ! ($instance instanceof VariantStrategyInterface)) {
            throw new RuntimeException("Variant strategy created for '{$strategy}' is of incorrect type");
        }

        return $instance->setOptions($options);
    }
794801
function Strategy(options, verify) {
	options = options || {};
	profileUrl = options.profileURL || null;
	providerUrl = options.providerURL || null;
	options.authorizationURL = providerUrl + 'dialog/authorize';
	options.tokenURL = providerUrl + 'oauth/token';
	options.scopeSeparator = options.scopeSeparator || ',';

	OAuth2Strategy.call(this, options, verify);
	this.name = 'signature';
	this._profileUrl = profileUrl;
}
654377
public function getStrategy($name)
    {
        $name = (string) $name;

        if (! isset($this->strategies[$name])) {
            throw new InvalidArgumentException(sprintf(
                'Unknown escaper strategy "%s".',
                $name
            ));
        }

        return $this->strategies[$name];
    }
643025
protected function determineModelReferenceStrategy(Model $model, $strategy = null)
    {
        if (null !== $strategy) {
            $strategy = $this->makeReferenceStrategyInstance($strategy);
        }

        if ( ! $strategy) {
            $strategy = $this->makeReferenceStrategy($model);
        }

        if ( ! $strategy) {
            $strategy = $this->getDefaultReferenceStrategyInstance();
        }

        return $strategy;
    }
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;
    }
1197849
public function buildStrategy($strategy, $concrete = null)
    {
        // If we passed a concrete implementation
        // look for it specifically
        $handle = Str::snake($strategy, '-');
        if ($concrete) {
            $handle .= '.'.Str::snake($concrete, '-');
        }

        // If no found instance, create a new one
        $handle = 'rocketeer.strategies.'.$handle;
        if (!$this->container->has($handle)) {
            $option = Str::snake($strategy, '-');
            $concrete = $concrete ?: $this->config->getContextually('strategies.'.$option);
            $strategy = $this->buildStrategyFromName($strategy, $concrete);
            if (!$strategy) {
                return;
            }

            $this->container->add($handle, $strategy);
        }

        // Get and register modules
        /** @var AbstractStrategy $strategy */
        $strategy = $this->container->get($handle);
        $strategy = $this->modulable->registerBashModulesOn($strategy);

        return $strategy;
    }
213323
public function applyStrategy($options, $context) {
		if ($context->type() !== 'read') {
			return;
		}

		$options += ['strategy' => 'joined'];
		if (!$model = $context->model()) {
			throw new ConfigException('The `\'with\'` option need a valid `\'model\'` option.');
		}

		$strategy = $options['strategy'];
		if (isset($this->_strategies[$strategy])) {
			$strategy = $this->_strategies[$strategy];
			$strategy($model, $context);
		} else {
			throw new QueryException("Undefined query strategy `{$strategy}`.");
		}
	}
121667
public function setSaveStrategy($strategy)
    {
        if (!in_array($strategy, [self::SAVE_APPEND, self::SAVE_REPLACE])) {
            $msg = sprintf('Invalid save strategy "%s"', $strategy);
            throw new InvalidArgumentException($msg);
        }

        $this->_saveStrategy = $strategy;

        return $this;
    }
700828
public ObjectMarshallingStrategy getStrategyObject(String strategyName) {
        if( StringUtils.isEmpty(strategyName) ) { 
            return null;
        }
        if (strategyName.startsWith("org.drools.marshalling.impl")) {
            strategyName = strategyName.replaceFirst("org.drools.marshalling.impl", "org.drools.core.marshalling.impl");
        }
        
        for( int i = 0; i < this.strategiesList.length; ++i ) { 
        	 if( strategiesList[i].getName().equals(strategyName) ) {
            		return strategiesList[i];
            }
        }
        throw new RuntimeException( "Unable to find PlaceholderResolverStrategy for name : " + strategyName );
    }
527766
public function renderMedia(MediaInterface $media, array $options = array())
    {
        /** @var DisplayMediaInterface $strategy */
        foreach ($this->strategies as $strategy) {
            if ($strategy->support($media)) {
                return $strategy->renderMedia($media, $options);
            }
        }

        return $this->defaultStrategy->renderMedia($media, $options);
    }
619377
public function createMyCredentials($strategy, $credentials, array $options = [])
    {
        $options['httpParams'][':strategy'] = $strategy;

        return $this->query($this->buildQueryArgs('auth', 'createMyCredentials'), ['body' => $credentials], $options)['result'];
    }
503016
public function register($name, AuthStrategy $strategy)
    {
        if($this->getOrNull($name)) {
            throw new StrategyAlreadyRegisteredException;
        };

        $this->strategies[$name] = $strategy;

        return $this;
    }
612112
private function getOption($option, array $options)
    {
        return isset($options[$option]) ? $options[$option] : $this->$option;
    }
610372
protected function getStrategyOption(InputInterface $input)
    {
        $strategy = strtolower($input->getOption(MigrateMessage::OPT_STRATEGY));
        if (!isset($this->strategies[$strategy])) {
            throw new CliException(sprintf(
                'Unknown strategy "%s". Must be one of: %s',
                $strategy,
                implode(', ', array_keys($this->strategies))
            ));
        }

        return $this->strategies[$strategy];
    }
1214302
public static function getInstance($options = []){
        if (is_null(self::$_instance)) {
            self::$_instance = new static($options);
        }
        return self::$_instance;
    }
14838
public function get($strategy = null)
    {
        if(!$strategy) {
            return $this->defaultStrategy;
        }

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

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

        return $strategy;
    }
29732
protected function buildStrategies()
    {
        foreach ($this->strategies as $parameterName => &$strategy) {

            // only build strategies we will actually use

            if ($this->isParameterIgnored($parameterName)) continue;

            // get the value for the filter parameter
            // and if it is empty, we're not filtering by it and should skip it
            $parameterValue = $this->parameterValue($parameterName);

            if ($this->isParameterValueUnset($parameterName, $parameterValue)) continue;

            // check if the strategy is a string that should be instantiated as a class
            if (is_string($strategy) && $strategy !== static::SETTING) {

                try {

                    $reflection = new ReflectionClass($strategy);

                    if ( ! $reflection->IsInstantiable()) {
                        throw new ParameterStrategyInvalidException("Uninstantiable string provided as strategy for '{$strategy}'");
                    }

                    $strategy = new $strategy();

                } catch (\Exception $e) {

                    throw new ParameterStrategyInvalidException(
                        "Exception thrown while trying to reflect or instantiate string provided as strategy for '{$strategy}'",
                        0, $e
                    );
                }

                // check if it is of the correct type
                if ( ! is_a($strategy, ParameterFilterInterface::class)) {

                    throw new ParameterStrategyInvalidException(
                        "Instantiated string provided is not a ParameterFilter: '" . get_class($strategy) . "'"
                    );
                }
            }
        }

        unset($strategy);

        return $this->strategies;
    }