public function findFeatures($path)
{
$finder = Finder::create()->sortByName()->in($path)->name('*.feature');
$result = new FeatureDirectory('');
foreach ($finder as $file) {
$feature = (string) $file;
if (0 !== strpos($feature, $path)) {
throw new \LogicException(sprintf('Feature resolved out of path: %s (out of %s).', $feature, $path));
}
$feature = substr($feature, strlen($path) + 1);
$feature = str_replace('\\', '/', $feature);
$this->addToDirectory($result, $feature);
}
return $result;
}
/** * @return FeatureDirectory */ public function getFeatures() { if (null === $this->path || !is_dir($this->path)) { throw new \RuntimeException(sprintf('Path "%s" does not exist.', $this->path)); } $path = $this->path . '/' . $this->getFeaturesPath(); if (!is_dir($path)) { throw new \RuntimeException(sprintf('Folder "%s" does not exist.', $path)); } $finder = new FeatureFinder(); return $finder->findFeatures($path); }