Last active
August 29, 2015 14:03
-
-
Save davidmars/a826026d793be3bf2b40 to your computer and use it in GitHub Desktop.
To know if a class uses a trait
This file contains 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
<?php | |
/** | |
* To know if a class uses a trait | |
* @param string $className The class name to inspect | |
* @param string $traitName The trait class name | |
* @return bool true if $className uses $traitName | |
*/ | |
function is_using($className,$traitName){ | |
return in_array($traitName,class_uses($className)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment