1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- declare(strict_types=1);
- namespace OC\Avatar;
- use OCP\Files\SimpleFS\InMemoryFile;
- use OCP\Files\SimpleFS\ISimpleFile;
- use Psr\Log\LoggerInterface;
- class GuestAvatar extends Avatar {
-
- public function __construct(
- private string $userDisplayName,
- LoggerInterface $logger,
- ) {
- parent::__construct($logger);
- }
-
- public function exists(): bool {
-
- return true;
- }
-
- public function getDisplayName(): string {
- return $this->userDisplayName;
- }
-
- public function set($data): void {
-
- }
-
- public function remove(bool $silent = false): void {
-
- }
-
- public function getFile(int $size, bool $darkTheme = false): ISimpleFile {
- $avatar = $this->generateAvatar($this->userDisplayName, $size, $darkTheme);
- return new InMemoryFile('avatar.png', $avatar);
- }
-
- public function userChanged(string $feature, $oldValue, $newValue): void {
- if ($feature === 'displayName') {
- $this->userDisplayName = $newValue;
- }
- }
-
- public function isCustomAvatar(): bool {
- return false;
- }
- }
|