@@ -18,84 +18,84 @@ |
||
18 | 18 | * This class represents a guest user's avatar. |
19 | 19 | */ |
20 | 20 | class GuestAvatar extends Avatar { |
21 | - /** |
|
22 | - * GuestAvatar constructor. |
|
23 | - * |
|
24 | - * @param string $userDisplayName The guest user display name |
|
25 | - */ |
|
26 | - public function __construct( |
|
27 | - private string $userDisplayName, |
|
28 | - IConfig $config, |
|
29 | - LoggerInterface $logger, |
|
30 | - ) { |
|
31 | - parent::__construct($config, $logger); |
|
32 | - } |
|
21 | + /** |
|
22 | + * GuestAvatar constructor. |
|
23 | + * |
|
24 | + * @param string $userDisplayName The guest user display name |
|
25 | + */ |
|
26 | + public function __construct( |
|
27 | + private string $userDisplayName, |
|
28 | + IConfig $config, |
|
29 | + LoggerInterface $logger, |
|
30 | + ) { |
|
31 | + parent::__construct($config, $logger); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Tests if the user has an avatar. |
|
36 | - */ |
|
37 | - public function exists(): bool { |
|
38 | - // Guests always have an avatar. |
|
39 | - return true; |
|
40 | - } |
|
34 | + /** |
|
35 | + * Tests if the user has an avatar. |
|
36 | + */ |
|
37 | + public function exists(): bool { |
|
38 | + // Guests always have an avatar. |
|
39 | + return true; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Returns the guest user display name. |
|
44 | - */ |
|
45 | - public function getDisplayName(): string { |
|
46 | - return $this->userDisplayName; |
|
47 | - } |
|
42 | + /** |
|
43 | + * Returns the guest user display name. |
|
44 | + */ |
|
45 | + public function getDisplayName(): string { |
|
46 | + return $this->userDisplayName; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Setting avatars isn't implemented for guests. |
|
51 | - * |
|
52 | - * @param \OCP\IImage|resource|string $data |
|
53 | - */ |
|
54 | - public function set($data): void { |
|
55 | - // unimplemented for guest user avatars |
|
56 | - } |
|
49 | + /** |
|
50 | + * Setting avatars isn't implemented for guests. |
|
51 | + * |
|
52 | + * @param \OCP\IImage|resource|string $data |
|
53 | + */ |
|
54 | + public function set($data): void { |
|
55 | + // unimplemented for guest user avatars |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Removing avatars isn't implemented for guests. |
|
60 | - */ |
|
61 | - public function remove(bool $silent = false): void { |
|
62 | - // unimplemented for guest user avatars |
|
63 | - } |
|
58 | + /** |
|
59 | + * Removing avatars isn't implemented for guests. |
|
60 | + */ |
|
61 | + public function remove(bool $silent = false): void { |
|
62 | + // unimplemented for guest user avatars |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Generates an avatar for the guest. |
|
67 | - */ |
|
68 | - public function getFile(int $size, bool $darkTheme = false): ISimpleFile { |
|
69 | - $avatar = $this->generateAvatar($this->userDisplayName, $size, $darkTheme); |
|
70 | - return new InMemoryFile('avatar.png', $avatar); |
|
71 | - } |
|
65 | + /** |
|
66 | + * Generates an avatar for the guest. |
|
67 | + */ |
|
68 | + public function getFile(int $size, bool $darkTheme = false): ISimpleFile { |
|
69 | + $avatar = $this->generateAvatar($this->userDisplayName, $size, $darkTheme); |
|
70 | + return new InMemoryFile('avatar.png', $avatar); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Updates the display name if changed. |
|
75 | - * |
|
76 | - * @param string $feature The changed feature |
|
77 | - * @param mixed $oldValue The previous value |
|
78 | - * @param mixed $newValue The new value |
|
79 | - */ |
|
80 | - public function userChanged(string $feature, $oldValue, $newValue): void { |
|
81 | - if ($feature === 'displayName') { |
|
82 | - $this->userDisplayName = $newValue; |
|
83 | - } |
|
84 | - } |
|
73 | + /** |
|
74 | + * Updates the display name if changed. |
|
75 | + * |
|
76 | + * @param string $feature The changed feature |
|
77 | + * @param mixed $oldValue The previous value |
|
78 | + * @param mixed $newValue The new value |
|
79 | + */ |
|
80 | + public function userChanged(string $feature, $oldValue, $newValue): void { |
|
81 | + if ($feature === 'displayName') { |
|
82 | + $this->userDisplayName = $newValue; |
|
83 | + } |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Guests don't have custom avatars. |
|
88 | - */ |
|
89 | - public function isCustomAvatar(): bool { |
|
90 | - return false; |
|
91 | - } |
|
86 | + /** |
|
87 | + * Guests don't have custom avatars. |
|
88 | + */ |
|
89 | + public function isCustomAvatar(): bool { |
|
90 | + return false; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * Different color than for authorized user with the same name |
|
96 | - * to make it harder to impersonate people. |
|
97 | - */ |
|
98 | - public function avatarBackgroundColor(string $hash): Color { |
|
99 | - return parent::avatarBackgroundColor($hash . ' (guest)'); |
|
100 | - } |
|
94 | + /** |
|
95 | + * Different color than for authorized user with the same name |
|
96 | + * to make it harder to impersonate people. |
|
97 | + */ |
|
98 | + public function avatarBackgroundColor(string $hash): Color { |
|
99 | + return parent::avatarBackgroundColor($hash . ' (guest)'); |
|
100 | + } |
|
101 | 101 | } |
@@ -96,6 +96,6 @@ |
||
96 | 96 | * to make it harder to impersonate people. |
97 | 97 | */ |
98 | 98 | public function avatarBackgroundColor(string $hash): Color { |
99 | - return parent::avatarBackgroundColor($hash . ' (guest)'); |
|
99 | + return parent::avatarBackgroundColor($hash.' (guest)'); |
|
100 | 100 | } |
101 | 101 | } |