fix calendar css, take 2. (#213)
[openemr.git] / interface / modules / zend_modules / library / Zend / Stdlib / Hydrator / Strategy / StrategyChain.php
bloba9316bbd7c0c1581881a97f6a09b94c543de0ac9
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Stdlib\Hydrator\Strategy;
12 use Traversable;
13 use Zend\Stdlib\ArrayUtils;
15 final class StrategyChain implements StrategyInterface
17 /**
18 * Strategy chain for extraction
20 * @var StrategyInterface[]
22 private $extractionStrategies;
24 /**
25 * Strategy chain for hydration
27 * @var StrategyInterface[]
29 private $hydrationStrategies;
31 /**
32 * Constructor
34 * @param array|Traversable $extractionStrategies
36 public function __construct($extractionStrategies)
38 $extractionStrategies = ArrayUtils::iteratorToArray($extractionStrategies);
39 $this->extractionStrategies = array_map(
40 function (StrategyInterface $strategy) {
41 // this callback is here only to ensure type-safety
42 return $strategy;
44 $extractionStrategies
47 $this->hydrationStrategies = array_reverse($extractionStrategies);
50 /**
51 * {@inheritDoc}
53 public function extract($value)
55 foreach ($this->extractionStrategies as $strategy) {
56 $value = $strategy->extract($value);
59 return $value;
62 /**
63 * {@inheritDoc}
65 public function hydrate($value)
67 foreach ($this->hydrationStrategies as $strategy) {
68 $value = $strategy->hydrate($value);
71 return $value;