mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-08 23:18:16 +02:00
25 lines
558 B
PHP
25 lines
558 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Behavioral\Mediator;
|
|
|
|
class UserRepositoryUiMediator implements Mediator
|
|
{
|
|
public function __construct(private UserRepository $userRepository, private Ui $ui)
|
|
{
|
|
$this->userRepository->setMediator($this);
|
|
$this->ui->setMediator($this);
|
|
}
|
|
|
|
public function printInfoAbout(string $user)
|
|
{
|
|
$this->ui->outputUserInfo($user);
|
|
}
|
|
|
|
public function getUser(string $username): string
|
|
{
|
|
return $this->userRepository->getUserName($username);
|
|
}
|
|
}
|