From ea3e477a74e2a3df21cef7326bed19b2dd357bda Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Tue, 24 Sep 2013 13:01:41 +0200 Subject: [PATCH] README in Visitor --- Visitor/README.md | 8 ++++++++ Visitor/Role.php | 9 +-------- 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 Visitor/README.md diff --git a/Visitor/README.md b/Visitor/README.md new file mode 100644 index 0000000..1ad8cc0 --- /dev/null +++ b/Visitor/README.md @@ -0,0 +1,8 @@ +# 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. diff --git a/Visitor/Role.php b/Visitor/Role.php index 6f5a0c4..b4873ce 100644 --- a/Visitor/Role.php +++ b/Visitor/Role.php @@ -3,14 +3,7 @@ namespace DesignPatterns\Visitor; /** - * Visitor Pattern - * - * 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 an contract to allow visitors (the "accept" method in the example below). - * - * 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. + * class Role */ abstract class Role {