mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-11 17:34:09 +02:00
start a restructure
This commit is contained in:
32
Behavioral/Visitor/User.php
Normal file
32
Behavioral/Visitor/User.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Visitor;
|
||||
|
||||
/**
|
||||
* Visitor Pattern
|
||||
*
|
||||
* One example for a visitee. Each visitee has to extends Role
|
||||
*/
|
||||
class User extends Role
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = (string) $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "User " . $this->name;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user