Change index.rst to README.rst

remove all pattern's README.md
This commit is contained in:
Faust
2015-04-05 06:05:24 +02:00
parent 818c221c78
commit ff327e3a0c
77 changed files with 45 additions and 647 deletions

View File

@@ -0,0 +1,68 @@
`Visitor`_
==========
Purpose
-------
The Visitor Pattern lets you outsource operations on objects to other
objects. The main reason to do this is to keep a separation of concerns.
But classes have to define a contract to allow visitors (the
``Role::accept`` method in the example).
The contract is an abstract class but you can have also a clean
interface. In that case, each Visitor has to choose itself which method
to invoke on the visitor.
UML Diagram
-----------
.. image:: uml/uml.png
:alt: Alt Visitor UML Diagram
:align: center
Code
----
You can also find these code on `GitHub`_
Group.php
.. literalinclude:: Group.php
:language: php
:linenos:
Role.php
.. literalinclude:: Role.php
:language: php
:linenos:
RolePrintVisitor.php
.. literalinclude:: RolePrintVisitor.php
:language: php
:linenos:
User.php
.. literalinclude:: User.php
:language: php
:linenos:
RoleVisitorInterface.php
.. literalinclude:: RoleVisitorInterface.php
:language: php
:linenos:
Test
----
Tests/VisitorTest.php
.. literalinclude:: Tests/VisitorTest.php
:language: php
:linenos:
.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Visitor
.. _`Visitor`: http://en.wikipedia.org/wiki/Visitor_pattern