Creational/Prototype/README.rst
Prototype__To avoid the cost of creating objects the standard way (new Foo()) and instead create a prototype and clone it.
.. image:: uml/uml.png :alt: Alt Prototype UML Diagram :align: center
You can also find this code on GitHub_
BookPrototype.php
.. literalinclude:: BookPrototype.php :language: php :linenos:
BarBookPrototype.php
.. literalinclude:: BarBookPrototype.php :language: php :linenos:
FooBookPrototype.php
.. literalinclude:: FooBookPrototype.php :language: php :linenos:
Tests/PrototypeTest.php
.. literalinclude:: Tests/PrototypeTest.php :language: php :linenos:
.. _GitHub: https://github.com/DesignPatternsPHP/DesignPatternsPHP/tree/main/Creational/Prototype
.. __: http://en.wikipedia.org/wiki/Prototype_pattern