SimpleFactory is a simple factory pattern.
It differs from the static factory because it is not static. Therefore, you can have multiple factories, differently parametrized, you can subclass it and you can mock it. It always should be preferred over a static factory!
You can also find this code on GitHub
SimpleFactory.php
.. literalinclude:: SimpleFactory.php :language: php :linenos:
Bicycle.php
.. literalinclude:: Bicycle.php :language: php :linenos:
$factory = new SimpleFactory();
$bicycle = $factory->createBicycle();
$bicycle->driveTo('Paris');
Tests/SimpleFactoryTest.php
.. literalinclude:: Tests/SimpleFactoryTest.php :language: php :linenos: