Created
January 2, 2014 14:55
-
-
Save Danack/8220375 to your computer and use it in GitHub Desktop.
parsing class names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getClassName($namespaceClass) { | |
$lastSlashPosition = mb_strrpos($namespaceClass, '\\'); | |
if ($lastSlashPosition !== false) { | |
return mb_substr($namespaceClass, $lastSlashPosition + 1); | |
} | |
return $namespaceClass; | |
} | |
function getNamespace($namespaceClass) { | |
$lastSlashPosition = mb_strrpos($namespaceClass, '\\'); | |
if ($lastSlashPosition !== false) { | |
return mb_substr($namespaceClass, 0, $lastSlashPosition); | |
} | |
return "\\"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment