mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-03 21:47:25 +02:00
execute read-the-docs.sh
This commit is contained in:
45
Structural/FluentInterface/index.rst
Normal file
45
Structural/FluentInterface/index.rst
Normal file
@@ -0,0 +1,45 @@
|
||||
Fluent Interface
|
||||
================
|
||||
|
||||
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
|
||||
-----------
|
||||
|
||||
.. image:: uml/uml.png
|
||||
:alt: Alt FluentInterface UML Diagram
|
||||
:align: center
|
||||
|
||||
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:
|
||||
|
||||
.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/FluentInterface
|
Reference in New Issue
Block a user