Skip to content

Commit

Permalink
Merge pull request #30 from navarr/fix-getProviders-on-win
Browse files Browse the repository at this point in the history
Update Yasumi::getProviders for platform agnosticism
  • Loading branch information
stelgenhof committed May 5, 2016
2 parents 46d1f85 + c504428 commit 2b33e62
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Yasumi/Yasumi.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ public static function getProviders()
return $providers;
}

$ds = DIRECTORY_SEPARATOR;

$extension = 'php';
$providers = [];
$filesIterator = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/Provider/'),
$filesIterator = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . $ds . 'Provider' . $ds),
RecursiveIteratorIterator::SELF_FIRST);

foreach ($filesIterator as $file) {
Expand All @@ -135,7 +137,10 @@ public static function getProviders()
continue;
}

$provider = preg_replace('#^.+/Provider/(.+)\.php$#', '$1', $file->getPathName());
$quotedDs = preg_quote($ds);
$regex = "#^.+{$quotedDs}Provider{$quotedDs}(.+)\\.php$#";

$provider = preg_replace($regex, '$1', $file->getPathName());

$providers[] = $provider;
}
Expand Down

0 comments on commit 2b33e62

Please sign in to comment.