Skip to content

Files

Latest commit

2f467fe · Apr 4, 2017

History

History
This branch is 435 commits behind DesignPatternsPHP/DesignPatternsPHP:main.

Bridge

Purpose

Decouple an abstraction from its implementation so that the two can vary independently.

Examples

UML Diagram

Alt Bridge UML Diagram

Code

You can also find this code on GitHub

FormatterInterface.php

.. literalinclude:: FormatterInterface.php
   :language: php
   :linenos:

PlainTextFormatter.php

.. literalinclude:: PlainTextFormatter.php
   :language: php
   :linenos:

HtmlFormatter.php

.. literalinclude:: HtmlFormatter.php
   :language: php
   :linenos:

Service.php

.. literalinclude:: Service.php
   :language: php
   :linenos:

HelloWorldService.php

.. literalinclude:: HelloWorldService.php
   :language: php
   :linenos:

Test

Tests/BridgeTest.php

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