Re: Date methods simplified

From: Date: Wed, 22 May 2002 16:04:32 +0000
Subject: Re: Date methods simplified
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6339@lists.php.net to get a copy of this message
Mika Tuupola wrote:
On Wed, 22 May 2002, Alan Knowles wrote:
guess they come from the java port, however in PHP unless the seconds where private, $this->_seconds etc., or when php5 adds private var, the tempation would be to access these directly???
This is might be a matter of taste, but I allways prefer having get methods for all variables and using them. This way you can be sure you don't have to change any code using the class if internal presentation of the variable changes. in the same way you can be sure that the methods wont change :) - yeah it very much taste..
without documentation... - read this in some source, without knowing how the date class works... $date->getTime() returns ? a) "10:30" b) 103434034040 it looks like it should return a) or similar, however it returns b)... - the utime... this ones a prime candidate for changing ... there looks like alot overlap in the two classes and php4/pear.. http://docs.akbkhome.com/pear/classes/Date_Calc.html and this. http://docs.akbkhome.com/pearcvs/classes/Date.html the tempation with the date class is to break it up a little -- core stuff (Date?) simple get/set + getUnixTime(), format(...); -- more complex stuff.. (Date_Calc extends Date) = a merge of Date_Calc and this one... isWeekday..., getJulianDate(), before, after...... anyway enough back seat driving for one night regards alan


« previous php.pear.dev (#6339) next »