FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [View Raw Code]   [Original HTTPS Page]

DesignPatternsPHP/Structural/FluentInterface/README.rst at master · JavaDevl/DesignPatternsPHP · GitHub

Latest commit

 

History

History
46 lines (32 loc) · 882 Bytes

File metadata and controls

46 lines (32 loc) · 882 Bytes

Purpose

To write code that is easy readable just like sentences in a natural language (like English).

Examples

  • Doctrine2's QueryBuilder works something like that example class below
  • PHPUnit uses fluent interfaces to build mock objects
  • Yii Framework: CDbCommand and CActiveRecord use this pattern, too

UML Diagram

Code

You can also find these code on GitHub

Sql.php

.. literalinclude:: Sql.php
   :language: php
   :linenos:

Test

Tests/FluentInterfaceTest.php

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


Back | FazBrowse Home | New Git URL