mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 01:32:22 +01:00
24 lines
424 B
PHP
24 lines
424 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Behavioral\Visitor;
|
|
|
|
class Group implements Role
|
|
{
|
|
private string $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);
|
|
}
|
|
}
|