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(string $name, ?object $object = null) : string { $strategy = $this->namingStrategies[$name] ?? $this->defaultNamingStrategy; return $strategy->extract($name); } /** * {@inheritDoc} */ public function hydrate(string $name, ?array $data = null) : string { $strategy = $this->namingStrategies[$name] ?? $this->defaultNamingStrategy; return $strategy->hydrate($name); } }