filename = $filename; } /** * Read the input and return a Configuration, returns null if the config * is not supported. * * @throws InvalidConfiguration */ public function getEntityManager(?string $name = null): EntityManagerInterface { if ($name !== null) { throw new InvalidArgumentException('Only one connection is supported'); } if (! file_exists($this->filename)) { throw FileNotFound::new($this->filename); } $params = include $this->filename; if ($params instanceof EntityManagerInterface) { return $params; } if ($params instanceof EntityManagerLoader) { return $params->getEntityManager(); } throw InvalidConfiguration::invalidArrayConfiguration(); } }