mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-29 03:00:15 +02:00
27 lines
452 B
PHP
27 lines
452 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Behavioral\Visitor;
|
|
|
|
class Group implements Role
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
private $name;
|
|
|
|
public function __construct(string $name)
|
|
{
|
|
$this->name = $name;
|
|
}
|
|
|
|
public function getName(): string
|
|
{
|
|
return sprintf('Group: %s', $this->name);
|
|
}
|
|
|
|
public function accept(RoleVisitor $visitor)
|
|
{
|
|
$visitor->visitGroup($this);
|
|
}
|
|
}
|