mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-25 22:09:23 +02:00
30 lines
432 B
PHP
30 lines
432 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Visitor;
|
|
|
|
/**
|
|
* Visitor Pattern
|
|
*
|
|
* An implementation of a concrete Visitor
|
|
*/
|
|
class RolePrintVisitor implements RoleVisitor
|
|
{
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function visitGroup(Group $role)
|
|
{
|
|
echo "Role: " . $role->getName();
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function visitUser(User $role)
|
|
{
|
|
echo "Role: " . $role->getName();
|
|
}
|
|
|
|
}
|