Exemple #1
0
 /**
  * Construct a new path normalizer.
  *
  * @param PathFactoryInterface|null $factory The path factory to use.
  */
 public function __construct(PathFactoryInterface $factory = null)
 {
     if (null === $factory) {
         $factory = PathFactory::instance();
     }
     $this->factory = $factory;
 }
 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);
 }
Exemple #3
0
 /**
  * Create a new instance of the default path factory.
  *
  * @return PathFactoryInterface The new default path factory instance.
  */
 protected function createDefaultPathFactory()
 {
     return PathFactory::instance();
 }