php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
687 stars 134 forks source link

What is the $index parameter purpose here ? #209

Closed maximejobin closed 5 years ago

maximejobin commented 5 years ago

I was looking at how it works to create a PO file from scratch and saw this function:

https://github.com/oscarotero/Gettext/blob/901c9d9c85d3f1fb9415c7ebcc314bd3ad2a4fc1/src/Translations.php#L206

What is the purpose of the $index parameter as it's not used in the function.

Am I missing something ?

oscarotero commented 5 years ago

This parameter is only to comply with the ArrayAccess interface (https://www.php.net/manual/en/arrayaccess.offsetset.php) used by this class to allow to get/set translations using the array syntax.