You are here

public function AbstractHydrator::getStrategy in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-hydrator/src/AbstractHydrator.php \Zend\Hydrator\AbstractHydrator::getStrategy()

Gets the strategy with the given name.

Parameters

string $name The name of the strategy to get.:

Return value

Strategy\StrategyInterface

Throws

Exception\InvalidArgumentException

Overrides StrategyEnabledInterface::getStrategy

2 calls to AbstractHydrator::getStrategy()
AbstractHydrator::extractValue in vendor/zendframework/zend-hydrator/src/AbstractHydrator.php
Converts a value for extraction. If no strategy exists the plain value is returned.
AbstractHydrator::hydrateValue in vendor/zendframework/zend-hydrator/src/AbstractHydrator.php
Converts a value for hydration. If no strategy exists the plain value is returned.

File

vendor/zendframework/zend-hydrator/src/AbstractHydrator.php, line 58

Class

AbstractHydrator

Namespace

Zend\Hydrator

Code

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['*'];
}