Re: I18Nv2

From: Date: Mon, 08 Mar 2004 19:19:09 +0000
Subject: Re: I18Nv2
References: 1 2  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-879@lists.php.net to get a copy of this message
Hi Stefan Neufeind, you wrote: > Hi Mike, > > now that you announced the package is ready, I think you might be > glad to have others take a look at the source? Just take this mail as > friendly suggestions, not as a "must do it this way". Of course :) > a) in Country.php: imho you should move the initialisation of _codes > from the constructor directly into the class identifier or even into > a define() since I assume they won't be changed. That's just a matter of taste, but it's also rather my taste to move this to the property definition. > b) in Country.php, function getName(): > imho the use of @ to silence an error for a non-existant array-entry > is "not that clean". I'd go for a isset-check first ... I'm not really in favour of putting an PEAR::raiseError() into this method/class, there's already isValid()...? > c) in I18Nv2.php, function setLocale(): > the @access-tag is only used for public/private (maybe also > protected). But there is a @static-tag for the thing you'd like to > express. If you have problems during peardoc-generation with the > @static-tag, grab a copy of the latest template for phpDocumentor > from Greg's CVS. The @static-tag has been fixed recently for peardoc. > > d) in I18Nv2.php, functions setLocale/lastLocale(): > Maybe make the functions behave similar like the php-functions? From > the doc of setLocale: > > If locale is NULL or "0", the locale setting is not affected, only > the current setting is returned. Hm, as I18Nv2::setLocale() does already... > e) in I18Nv2.php, functions lastLocale() and others: > Is the use of getStaticProperty really necessary? Why not access them > directly, where needed, in your functions? In my POV (point of view - if Daniel is reading this, too :p) I see no reason for instantiating a I18Nv2 object, do you? > f) in I18Nv2.php, function getInfo(): > Not tested, but could there possibly a problem with $part? What if > it's 0 because I want the first part? I guess 0 would also evaluate > to false. Maybe use isset in your conditional statement to make clear > what you expect it to behave like. localeConv() returns an associative array, so there wont be a 0-index, if $part is 0, '', null, false... getInfo() will return all info gathered. > g) class I18Nv2_Locale: > Are your variables public or private? If private, please prefix those > with _. Otherwise please give some phpdoc-comments what these vars > (will) contain or are allowed to contain. Well, they're generally private, so I'll fix the underscore. > h) in Locale.php, function setCurrencyFormat(): > Again, I think we once stated that @-calls should be avoided where > possible. Maybe avoid? But this is up to you - and maybe others will > think differently about this ... in such cases. I agree with you in this context. > i) in Locale.php, functions time()/date(): > Maybe you should also use a default of null in your parameters and > use a isset() here in the conditional statement? What if somebody > wants to format 0:00 o' clock? $timestamp is a unix timstamp, but I'll fix this for the "0" timestamp. > k) in Negotiator.php, right before function __construct(): > Where the two // left there intentionally? :-)) yes > General remark: Maybe it would be a good idea to avoid the examples > at the beginning of your class-files and put them into the > docs/examples-directory? This is the appropriate place for them and > you can also include them in phpDocumentor afaik. I currently use PhpDocumentor only for building a basic doc skeleton and the examples given are not that exhaustive but useful if s-one's browsing the code. However, you can be shure that I'll write docs for that package like I did for each of mine (wollt' ich nur gesagt haben). :) Thanks, -- Michael - < mike(@)php.net >

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.pear.qa (#879) next »