Reply to Re: another parsing problem...

Your name:

Reply:


Posted by Good Man on 11/09/07 18:31

Jerry Stuckle <jstucklex@attglobal.net> wrote in news:ZOidnXa6r-
RzPKnanZ2dnUVZ_uLinZ2d@comcast.com:

>> PS: Any one know how to get the list of PRIVATE and PROTECTED methods
>> from a class? Without parsing the actual file?
>>
>>
>
> No, that's the whole purpose of PRIVATE and PROTECTED members. If you
> want to list them, you need the code as a class member.


Hiya...

I'm in the middle of learning OO programming, and probably not the
person to offer solutions, but perhaps I can use this moment to ask if
the following is a solution to his PS? And if it's not, perhaps someone
can explain to me why?

Let's say his class name is 'Veggie'

**

$prod_class = new ReflectionClass( 'Veggie' );
$methods = $prod_class->getMethods();

foreach($methods as $method) {
echo methodData($method);
}

function methodData(ReflectionMethod $method) {
$details = "";
$name = $method->getName();

if($method->isPrivate()) {
$details .= "$name is private<br>";
}
if($method->isProtected()) {
$details .= "$name is protected<br>";
}
if($method->isPublic()) {
$details .= "$name is public<br>";
}

return $details;

}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация