Open centurianii opened 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.
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)
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?
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!
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');