Make parent method check explicit to Shell.

This makes only methods on Shell inaccessible on the command line.
Parent methods in AppShell or other parent classes can now be called directly.
Fixes #2193
This commit is contained in:
mark_story 2011-11-06 16:32:51 -05:00
parent db41a7dd16
commit d87f9f060b

View file

@ -273,15 +273,12 @@ class Shell extends Object {
* @return boolean
*/
public function hasMethod($name) {
if (empty($this->_reflection)) {
$this->_reflection = new ReflectionClass($this);
}
try {
$method = $this->_reflection->getMethod($name);
$method = new ReflectionMethod($this, $name);
if (!$method->isPublic() || substr($name, 0, 1) === '_') {
return false;
}
if ($method->getDeclaringClass() != $this->_reflection) {
if ($method->getDeclaringClass()->name == 'Shell') {
return false;
}
return true;