Skip to content

Instantly share code, notes, and snippets.

@masihyeganeh
Last active October 13, 2015 06:58
Show Gist options
  • Save masihyeganeh/4156943 to your computer and use it in GitHub Desktop.
Save masihyeganeh/4156943 to your computer and use it in GitHub Desktop.
Snippet to get Only derived class's methods list
<?php
/**
* Gets public methods name of a class only defined in that class,
* not it's parent
*
* @param string $className Name of the class.
*
* @return array Returns list of methods.
*/
function getDerivedClassOnlyMethods($className)
{
return array_diff (
get_class_methods($className),
get_class_methods(get_parent_class($className))
);
}
$Derived_Class_Only_Methods_Name_List = getDerivedClassOnlyMethods('Class Name');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment