[RFC][BC] builder with and a new behavior
liuggio opened this issue · comments
Giulio De Donato commented
Hi all,
the idea is to have only 2 classes
The Generator
with a behavior like:
$shortId = new Generator()
->setLenght(7)
->setFactory(/* the ircmaxell/RandomLib factory adapter */)
->setSeed(1)
->setEasyToRead(false)
->getString("ABCDEFG123456") // or getInt?
;
and the ShortId
class would be a Value Object with a __toString() and is possible to create itself directly from the factory method
$shortId = ShortId::generate(/*alphabet*/); //it uses the Generator with the default options
Massimiliano Arione commented
Feel free to write a PR.
More details are welcome (maybe on slack?)
Massimiliano Arione commented
Giulio De Donato commented
+1