Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Tests
uml
CsvWriter.php
JsonWriter.php
README.rst
UnixCsvWriter.php
UnixJsonWriter.php
UnixWriterFactory.php
WinCsvWriter.php
WinJsonWriter.php
WinWriterFactory.php
WriterFactory.php

README.rst

Abstract Factory

Purpose

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, it just knows how they go together.

UML Diagram

Alt AbstractFactory UML Diagram

Code

You can also find this code on GitHub

WriterFactory.php

.. literalinclude:: WriterFactory.php
   :language: php
   :linenos:

CsvWriter.php

.. literalinclude:: CsvWriter.php
   :language: php
   :linenos:

JsonWriter.php

.. literalinclude:: JsonWriter.php
   :language: php
   :linenos:

UnixCsvWriter.php

.. literalinclude:: UnixCsvWriter.php
   :language: php
   :linenos:

UnixJsonWriter.php

.. literalinclude:: UnixJsonWriter.php
   :language: php
   :linenos:

UnixWriterFactory.php

.. literalinclude:: UnixWriterFactory.php
   :language: php
   :linenos:

WinCsvWriter.php

.. literalinclude:: WinCsvWriter.php
   :language: php
   :linenos:

WinJsonWriter.php

.. literalinclude:: WinJsonWriter.php
   :language: php
   :linenos:

WinWriterFactory.php

.. literalinclude:: WinWriterFactory.php
   :language: php
   :linenos:

Test

Tests/AbstractFactoryTest.php

.. literalinclude:: Tests/AbstractFactoryTest.php
   :language: php
   :linenos:

You can’t perform that action at this time.