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;
}