Gregwar / Captcha

PHP Captcha library
MIT License
1.73k stars 290 forks source link

PhraseBuilder definition errors #38

Open centurianii opened 7 years ago

centurianii commented 7 years ago

Convert all your functions to static if you want the examples to be correct like that one: $phrase = \Gregwar\Captcha\PhraseBuilder::build(5, '0123456789'); or, define constructor, build object and call member function: $phrase = new \Gregwar\Captcha\PhraseBuilder()->build(5, '0123456789');

centurianii commented 7 years ago

.. of course errors are passed to CaptchaBuilder too; suppose we want static calls: from $phrase = $this->builder->build(); should have $phrase = $this->builder::build(); etc.

Gregwar commented 7 years ago

In this case I think that it is not a good idea to have an instance However for BC reasons I think that he better would be updating the example to actually make an instance in it instead of changing that (even if I confess that it is not instance-related code in the default PhraseBuilder)

Gregwar commented 7 years ago

OK I changed it so the building arguments are passed to the builder on construct time This makes more sense because if an user wants to write its own logic it it he can benefits of having an instance, is it OK for you?

centurianii commented 7 years ago

PhraseBuilder is a collection of utilities as it does not have real properties. So, stick with static members, I did this in the code and it behaves fine!