Bug #12512 [Ver]: incorrect declaration of toWords() in lang.fr.php (and others!)

From: Date: Tue, 24 Aug 2010 17:51:04 +0000
Subject: Bug #12512 [Ver]: incorrect declaration of toWords() in lang.fr.php (and others!)
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-4654@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=12512&edit=1 ID: 12512 Updated by: ifeghali@php.net Reported By: niconours1 at yahoo dot fr Summary: incorrect declaration of toWords() in lang.fr.php (and others!) Status: Verified Type: Bug Package: Numbers_Words Operating System: Windows Package Version: 0.15.0 PHP Version: 5.2.4 -Assigned To: makler +Assigned To: ifeghali Roadmap Versions: New Comment: -Assigned To: makler +Assigned To: ifeghali Kouber, great, I should have it fixed by today. Best, ~IF. Previous Comments: ------------------------------------------------------------------------ [2010-08-23 11:58:59] kouber Indeed, it makes sense. That solution would save us the effort to rewrite all the drivers. ------------------------------------------------------------------------ [2010-08-20 15:48:04] ifeghali Added #patch bug:12512;patch:ifeghali_suggestion.txt;revision:1282319284;. ------------------------------------------------------------------------ [2010-08-20 14:53:48] ifeghali Ok thinking a bit about it, that is what I suggest (example for pt_BR driver): function toWords($num, $locale = 'pt_BR') { return parent::toWords($num, $locale); } function _toWords(specific parameters for each driver) { // this should be the old toWords() method } Number_Words::toWords() should call Driver::_toWords(). this is not going to break backwards compatibility and will make things more clear, imo. any thoughts ? ------------------------------------------------------------------------ [2010-08-20 13:17:33] ifeghali I would say this is a design flaw and we should rethink it carefully. or perhaps do something like that for each applicable driver: function toWords($num, $locale = null) { return $this->_toWords($num, $power, $powsufix); } and rename toWords to _toWords. thoughts ? ------------------------------------------------------------------------ [2010-08-20 12:05:41] ifeghali Just FYI, thats what we got today: lang.bg.php: function toWords($num = 0, $locale = null) lang.cs.php: function toWords($num, $power = 0, $powsuffix = '') lang.de.php: function toWords($num, $power = 0, $powsuffix = '') lang.dk.php: function toWords($num, $power = 0, $powsuffix = '') lang.en_100.php: function toWords($num, $power = 0, $powsuffix = '') lang.en_GB.php: function toWords($num, $power = 0, $powsuffix = '') lang.en_US.php: function toWords($num, $power = 0, $powsuffix = '') lang.es.php: function toWords($num, $power = 0) lang.es_AR.php: function toWords($num, $power = 0) lang.et.php: function toWords($num, $power = 0, $powsuffix = '') lang.fr.php: function toWords($num = 0, $locale = null) lang.fr_BE.php: function toWords($num = 0, $locale = null) lang.he.php: function toWords($num, $power = 0, $powsuffix = '') lang.hu_HU.php: function toWords($num, $power = 0, $powsuffix = '') lang.id.php: function toWords($num, $power = 0, $powsuffix = '') lang.it_IT.php: function toWords($num, $power = 0) lang.lt.php: function toWords($num, $power = 0, $powsuffix = '') lang.nl.php: function toWords($num, $power = 0, $powsuffix = '') lang.pl.php: function toWords($num, $power = 0, $powsuffix = '') lang.pt_BR.php: function toWords($num, $locale = null) lang.ru.php: function toWords($num, $gender = 1) lang.sv.php: function toWords($num, $power = 0, $powsuffix = '') ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://pear.php.net/bugs/bug.php?id=12512 -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=12512&edit=1

« previous php.pear.bugs (#4654) next »