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; } }