It is a factory method if it returns an instance of a class but is it a factory method if it returns multiple (an array of) instances?
If you need it to return multiple instances, then do it, regardless of how it is called. I would say it is indeed a factory method, but this doesn't matter that much.
Perhaps you can have a factory method for returning a single instance, and then another one that calls the first one multiple times.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With