To create series of related or dependent objects without specifying their concrete classes. Usually the created classes all implement the same interface. The client of the abstract factory does not care about how these objects are created, he just knows how they go together.
You can also find these code on GitHub
AbstractFactory.php
AbstractFactory.php
JsonFactory.php
JsonFactory.php
HtmlFactory.php
HtmlFactory.php
MediaInterface.php
MediaInterface.php
Picture.php
Picture.php
Text.php
Text.php
Json/Picture.php
Json/Picture.php
Json/Text.php
Json/Text.php
Html/Picture.php
Html/Picture.php
Html/Text.php
Html/Text.php
Tests/AbstractFactoryTest.php
Tests/AbstractFactoryTest.php