namingStrategies = array_map( function (NamingStrategyInterface $strategy) { // this callback is here only to ensure type-safety return $strategy; }, $strategies ); $this->defaultNamingStrategy = $defaultNamingStrategy ?: new IdentityNamingStrategy(); } /** * {@inheritDoc} */ public function extract($name) { $strategy = isset($this->namingStrategies[$name]) ? $this->namingStrategies[$name] : $this->defaultNamingStrategy; return $strategy->extract($name); } /** * {@inheritDoc} */ public function hydrate($name) { $strategy = isset($this->namingStrategies[$name]) ? $this->namingStrategies[$name] : $this->defaultNamingStrategy; return $strategy->hydrate($name); } }