Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.2

Request #13862 setting maxValue
Submitted: 2008-05-09 08:04 UTC
From: toro Assigned: davidc
Status: Closed Package: Text_CAPTCHA_Numeral (version 1.2.0)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2008-05-09 08:04 UTC] toro (Torsten Rosenberger)
Description: ------------ It would be nice if the minValue and maxValue are changeable (not private in the class, public would be better i thing) maxValue = 50; is not easy for everyone ;) BR /torsten

Comments

 [2010-01-02 15:12 UTC] poet (Chad Allard)
It wouldn't be hard to create a public function to set the values for maxValue and minValue (in other words, keep them private and use a function to modify their values outside the script). The only issue with this is that these calls: $this->generateFirstNumber(); $this->generateSecondNumber(); $this->generateOperator(); $this->generateOperation(); are done in the constructor of the class. That means that in order to modify the value, you would have to do so BEFORE those functions are called... which means removing the functions from the constructor, OR modifying the constructor to look for a min and max value. Something like this: public function __construct($complexityType = self::TEXT_CAPTCHA_NUMERAL_COMPLEXITY_ELEMENTARY, $max=50, $min=1) Then inside the constructor have function calls to the private function mutators: $this->setMaxValue($max); $this->setMinValue($min); In any case, I second the suggestion to change the minValue and maxValue
 [2010-04-16 18:23 UTC] davidc (David Coallier)
-Assigned To: +Assigned To: davidc
 [2010-04-16 18:27 UTC] davidc (David Coallier)
I've added the ability to supply the min and max values as the second and third parameter respectively in the constructor. However, for complexity level TEXT_CAPTCHA_NUMERAL_COMPLEXITY_HIGH_SCHOOL if the maxValue is smaller than 70 I'm overwriting the value passed in the constructor to 70 and the same goes for TEXT_CAPTCHA_NUMERAL_COMPLEXITY_UNIVERSITY if the value pass for the maxValue in the constructor is smaller than 100 I overwrite with the maxValue and set it to 100.
 [2010-04-16 18:28 UTC] davidc (David Coallier)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.