Skip to content

Commit

Permalink
fixed #6 - wrong class map on empty 'relative to' path for map
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Gladysch committed Nov 7, 2016
1 parent 97504e4 commit 75bf5c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/glady/Behind/ClassLoader/ClassMapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ public function generate($fileNamePattern = null)
}
$realPath = $file->getRealPath();
$realPath = str_replace("\\", '/', $realPath);
$mapPath = str_replace($me->getRelativeToPath() . '/', '', $realPath);
$relativeToPath = $me->getRelativeToPath();
if (!empty($relativeToPath) && strpos($realPath, $relativeToPath . '/') === 0) {
$mapPath = substr($realPath, strlen($relativeToPath) + 1);
}
else {
$mapPath = $realPath;
}
$map[$class] = $mapPath;
if (!$me->acceptsMultipleClassesPerFile()) {
return;
Expand Down

0 comments on commit 75bf5c5

Please sign in to comment.