Skip to content

Commit ea3e477

Browse files
author
Dominik Liebler
committed
README in Visitor
1 parent fe61270 commit ea3e477

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Visitor/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Visitor
2+
3+
## Purpose
4+
5+
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.
6+
But classes have to define a contract to allow visitors (the `Role::accept` method in the example).
7+
8+
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.

Visitor/Role.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33
namespace DesignPatterns\Visitor;
44

55
/**
6-
* Visitor Pattern
7-
*
8-
* Purpose:
9-
* The Visitor Pattern lets you outsource operations on objects to other objects. The main reason to do this is to keep
10-
* a separation of concerns. But classes have to define an contract to allow visitors (the "accept" method in the example below).
11-
*
12-
* The contract is an abstract class but you can have also a clean interface.
13-
* In that case, each Visitor has to choose itself which method to invoke on the visitor.
6+
* class Role
147
*/
158
abstract class Role
169
{

0 commit comments

Comments
 (0)