class StrategyChain in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-hydrator/src/Strategy/StrategyChain.php \Zend\Hydrator\Strategy\StrategyChain
- 8 vendor/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyChain.php \Zend\Stdlib\Hydrator\Strategy\StrategyChain
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-hydrator/src/Strategy/StrategyChain.php \Zend\Hydrator\Strategy\StrategyChain
Hierarchy
- class \Zend\Hydrator\Strategy\StrategyChain implements StrategyInterface
Expanded class hierarchy of StrategyChain
1 file declares its use of StrategyChain
- StrategyChain.php in vendor/zendframework/ zend-stdlib/ src/ Hydrator/ Strategy/ StrategyChain.php 
File
- vendor/zendframework/ zend-hydrator/ src/ Strategy/ StrategyChain.php, line 15 
Namespace
Zend\Hydrator\StrategyView source
class StrategyChain implements StrategyInterface {
  /**
   * Strategy chain for extraction
   *
   * @var StrategyInterface[]
   */
  private $extractionStrategies;
  /**
   * Strategy chain for hydration
   *
   * @var StrategyInterface[]
   */
  private $hydrationStrategies;
  /**
   * Constructor
   *
   * @param array|Traversable $extractionStrategies
   */
  public function __construct($extractionStrategies) {
    $extractionStrategies = ArrayUtils::iteratorToArray($extractionStrategies);
    $this->extractionStrategies = array_map(function (StrategyInterface $strategy) {
      // this callback is here only to ensure type-safety
      return $strategy;
    }, $extractionStrategies);
    $this->hydrationStrategies = array_reverse($extractionStrategies);
  }
  /**
   * {@inheritDoc}
   */
  public function extract($value) {
    foreach ($this->extractionStrategies as $strategy) {
      $value = $strategy
        ->extract($value);
    }
    return $value;
  }
  /**
   * {@inheritDoc}
   */
  public function hydrate($value) {
    foreach ($this->hydrationStrategies as $strategy) {
      $value = $strategy
        ->hydrate($value);
    }
    return $value;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| StrategyChain:: | private | property | Strategy chain for extraction | |
| StrategyChain:: | private | property | Strategy chain for hydration | |
| StrategyChain:: | public | function | Converts the given value so that it can be extracted by the hydrator. Overrides StrategyInterface:: | |
| StrategyChain:: | public | function | Converts the given value so that it can be hydrated by the hydrator. Overrides StrategyInterface:: | |
| StrategyChain:: | public | function | Constructor | 
