Skip to content

Commit

Permalink
Merge pull request #3 from mfairchild365/mapper-regressions
Browse files Browse the repository at this point in the history
Fix regressions for ClassToTemplateMapper replacements
  • Loading branch information
saltybeagle committed Oct 8, 2014
2 parents d8b58c7 + bc8e4c8 commit d07ffa3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Savvy/ClassToTemplateMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,17 @@ public function map($class)
$class = self::$output_template[$class];
}

$class = str_replace(self::$classname_replacement, '', $class);

$className = ltrim($class, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strrpos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}

$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . self::$template_extension;
$fileName .= str_replace(self::$directory_separator, DIRECTORY_SEPARATOR, $className) . self::$template_extension;

return $fileName;
}
Expand Down

0 comments on commit d07ffa3

Please sign in to comment.