/** * Configures a Mapper object for the given Keys * * The Mapper object can be configured externally by being returned and, as it is stored as a reference, * will be shared across all "mapped" keys. * * @param string[] $keys * @return Mapper * * @throws InvalidKeyException */ public function map(...$keys) { $mapper = $this->factory_mapper->createNew(); array_walk($keys, function ($key) use($mapper) { $this->checkKeyExists($key); $this->mappers[$key] = $mapper; }); return $mapper; }
/** * @test * @uses \Improv\Configuration\Test\Fixtures\ValidMapper */ public function injectedMapperClass() { $sut = new MapperFactory(ValidMapper::class); self::assertInstanceOf(ValidMapper::class, $sut->createNew()); }