@param mixed|callable|string|StrategyInterface $strategyName

@throws InvalidException

@return StrategyInterface
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');
    }
14838
public function get($strategy = null)
    {
        if(!$strategy) {
            return $this->defaultStrategy;
        }

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

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

        return $strategy;
    }
391819
public function createBatchJob(ProcessManager $manager, $data = null, StrategyInterface $strategy = null)
    {
        return new BatchJob($manager, $data, $strategy);
    }
65970
def invalidate(strategy, value = nil)
      (value = strategy; strategy = :id) unless strategy.is_a?(Symbol)
      # call the invalidate method of the chosen strategy
      @strategy_by_attribute[strategy].invalidate(value) if @strategy_by_attribute[strategy]
    end
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}`.");
		}
	}
399497
public function authenticate($strategy)
    {
        return $this->getStrategy($strategy)
                    ->authenticate($this->request, $this->response);
    }
645936
protected function _prepareStrategy (ModularStrategyInterface $strategy)
    {
        $this->env->makeFollower($strategy);
        
        if (!$strategy->shouldProcess()) {
            return false;
        }
        
        $strategy->prepare();
        
        return true;
    }
4091
public function strategy(string $strategy, array $options = []): ListFilter
    {
        $this->main['strategy'] = $strategy;

        if (count($options)) {
            $this->main['options'] = $options;
        }

        return $this;
    }
729467
protected function applyContextStrategyToQueryBuilder($query, $strategy, array $parameters = [])
    {
        $strategy = $this->resolveContextStrategy($strategy);

        if ( ! $strategy) return;

        $strategy->apply($query, $parameters);
    }
1193164
protected function buildCountableStrategies()
    {
        foreach ($this->countStrategies as &$strategy) {

            // check if the strategy is a string that should be instantiated as a class
            if (is_string($strategy)) {

                try {

                    $reflection = new ReflectionClass($strategy);

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

                    $strategy = new $strategy();

                } catch (\Exception $e) {

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

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

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

        unset($strategy);

        return $this->countStrategies;
    }
853441
public function login($strategy, Request $request)
    {
        $strategy = $this->get($strategy);
        $user = $strategy->convert($strategy->attempt($request));

        return $user;
    }
717168
public function getStrategy($name)
    {
        if (isset($this->strategies[$name])) {
            return $this->strategies[$name];
        }

        if (!isset($this->strategies['*'])) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s: no strategy by name of "%s", and no wildcard strategy present',
                __METHOD__,
                $name
            ));
        }

        return $this->strategies['*'];
    }
1136717
public function make($strategy, $key = null, ModelFilterDataInterface $info = null)
    {
        // A filter must have a resolvable strategy for displaying
        if ( ! ($strategyClass = $this->resolveStrategyClass($strategy))) {
            throw new RuntimeException(
                "Could not resolve filter strategy class for {$key}: '{$strategy}'"
            );
        }

        /** @var FilterStrategyInterface $instance */
        $instance = app($strategyClass);

        if (null !== $info) {
            $instance->setFilterInformation($info);
        }

        return $instance;
    }
563428
public function process( array $notifications, Strategy $strategy ) {

		/** @var Contract $one */
		$one = reset( $notifications );

		$subject    = $this->convert_tags( $one->get_subject() );
		$message    = $this->convert_tags( $one->get_message() );
		$merge_vars = $this->prepare_merge_vars( $notifications );
		$tos        = $this->prepare_to( $notifications );

		$args = array(
			'html'                => $message,
			'subject'             => $subject,
			'from_name'           => get_option( 'blogname' ),
			'from_email'          => get_option( 'admin_email' ),
			'to'                  => $tos,
			'auto_text'           => true,
			'merge_vars'          => $merge_vars,
			'preserve_recipients' => false
		);

		$args = wp_parse_args( $args, $this->defaults );

		if ( method_exists( $this->mandrill, 'messages_send' ) ) {
			$this->mandrill->messages_send( $args );
		} else {
			$this->mandrill->messages->send( $args );
		}

		foreach ( $notifications as $notification ) {
			$notification->set_strategy( new Null_Mail() )->send();
		}
	}
494296
protected static function convertPartialMatchStrategy($strategy)
  {
    /** @var RMatchStrategy $convertedStrategy */
    $convertedStrategy = null;
    if (!empty($strategy)) {
      $rules = $strategy->getRules();
      if (!empty($rules)) {
        $convertedStrategy = new RMatchStrategy();
        /** @var MPartialMatchRule $r */
        foreach ($rules as $r) {
          array_push($rules, Query::convertPartialMatchRule($r));
        }
        $strategy->setRules($rules);
      }
    }
    return $convertedStrategy;
  }
938303
public static AutoAssignStrategy getAutoAssignStrategy(String logicalName) throws StrategyException {
        TaskInstanceStrategyFactory factory = getInstance();
        String className = factory.getStrategyClassName(logicalName, StrategyType.AutoAssignStrategy);
        return (AutoAssignStrategy) factory.getStrategyInstance(AutoAssignStrategy.class, className, null);
    }
1254138
public function addWriter($level, LoggerInterface $strategy)
    {
        switch ($level) {
            default:
                throw new \InvalidArgumentException('Invalid $level');
            case LogLevel::DEBUG:
                $this->writers[LogLevel::DEBUG][] = $strategy;
            case LogLevel::INFO:
                $this->writers[LogLevel::INFO][] = $strategy;
            case LogLevel::NOTICE:
                $this->writers[LogLevel::NOTICE][] = $strategy;
            case LogLevel::WARNING:
                $this->writers[LogLevel::WARNING][] = $strategy;
            case LogLevel::ERROR:
                $this->writers[LogLevel::ERROR][] = $strategy;
            case LogLevel::CRITICAL:
                $this->writers[LogLevel::CRITICAL][] = $strategy;
            case LogLevel::ALERT:
                $this->writers[LogLevel::ALERT][] = $strategy;
            case LogLevel::EMERGENCY:
                $this->writers[LogLevel::EMERGENCY][] = $strategy;
        }
    }