joypixels / joypixels/emoji-toolkit
(PHP) Cannot override `emojiVersion` or `emojiSize`
- Dominant language
- PHP
- Stars
- 473
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
Hi there,
I would have expected this code:
```php
$client = new Client();
$client->emojiSize = 64;
echo $client->toImage('😀');
```
To produce `
`, since the code is documented to say we can set `emojiSize`: `"available sizes are '32', '64', and '128'"`, but instead it produced `
`,.
https://github.com/joypixels/emoji-toolkit/blob/7ed2733fac44df78fc7628cb51a0be5fb23066e3/lib/php/src/Client.php#L16
The issue is that since the `imagePathPNG` property is set in the constructor, it is too late use the `emojiSize` property on the `$client` instance.
https://github.com/joypixels/emoji-toolkit/blob/7ed2733fac44df78fc7628cb51a0be5fb23066e3/lib/php/src/Client.php#L36
A workaround is this, but I believe the code should act different, since it's not possible to customize it by setting the public property:
```php
$client = new class extends Client {
public $emojiSize = '64';
};
echo $client->toImage('😀');
```
Contributor guide
Assessment
This issue has not been assessed yet.