public function createFromFile($configFile) { $configPath = PathFactory::instance()->create($configFile); $loadConfigFile = $configPath->normalize(); if (file_exists($loadConfigFile) === false) { throw new ConfigFileNotFoundException($loadConfigFile); } $configDirectory = $configPath->parent(); $configValues = Toml::parse($loadConfigFile); $result = $this->flattener->flatten($configValues); foreach ($result as $key => $fixturePath) { $fixtureRelativePath = RelativePath::fromString($fixturePath); $fixturePath = $configDirectory->join($fixtureRelativePath); $result[$key] = (string) $fixturePath->normalize(); } return new FixtureContainer($result); }
/** * Validates a single path atom. * * This method is called internally by the constructor upon instantiation. * It can be overridden in child classes to change how path atoms are * validated. * * @param string $atom The atom to validate. * * @throws InvalidPathAtomExceptionInterface If an invalid path atom is encountered. */ protected function validateAtom($atom) { parent::validateAtom($atom); if (false !== strpos($atom, '\\')) { throw new PathAtomContainsSeparatorException($atom); } elseif (preg_match('/([\\x00-\\x1F<>:"|?*])/', $atom, $matches)) { throw new InvalidPathAtomCharacterException($atom, $matches[1]); } }