Files
DesignPatternsPHP/Behavioral/Visitor/README.md
Antonio Spinelli e59d70a0ac start a restructure
2014-03-21 18:03:45 -03:00

9 lines
429 B
Markdown

# 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.