Skip to content

Files

Latest commit

author
Dominik Liebler
Sep 24, 2013
ea3e477 · Sep 24, 2013

History

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

Visitor

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 12, 2013
Sep 24, 2013
Sep 24, 2013
Sep 12, 2013
Sep 12, 2013
Sep 12, 2013

README.md

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.