Re: strict nannying ...
|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stuart Dallas wrote:
No code duplication but clear separation between static and instantiated usage. However, this is not the best way to structure this code IMO. The better option would be to extract the static parts into a separate class, and use that new class from the instantiated version.
I've sort of got a problem with that since duplicating every content package class and then deciding which version I should be accessing does not make sense. I'm slowly pulling the 'static' elements into their own function and leaving the instantiated elements alone but it's slow work. Those people who kept telling me 'just fix the errors' simply don't understand how complex that CAN be :( I've only worked my way through half a dozen packages and I've 20 or so to go ... all just to bring things 'up to acceptable php code' ;)
I think I've got that under control now. the 'parent::' was giving me errors for other reasons.> With reference to the above, does self:: replace parent:: when trying to call the base functionality which is where I think I am trying to head ... getDisplayUrl() gives me a url in one of a number of formats depending what style of url is selected, and the base package that created it, so the use both statically and 'dynamically' made perfect sense 10 years ago:)Using a class both statically and as instantiated objects makes sense now, never mind ten years ago, but it has never made sense for both uses to share the same entry points. It was possible, but that doesn't mean it makes sense. The self and parent keywords do exactly what they say on the tin. Self refers to the current class and parent refers to the parent class, both in a static context. Some of these things are pretty self-explanatory.
-- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php