[TYPO3-core] Wrapper methods around globals?
Alexander Stehlik
alexander.stehlik at gmail.com
Wed Mar 19 16:56:49 CET 2014
This is indeed a very good point! The usage of a local variable reduces
the performance impact of the getter methods. Didn't think about this
before.
Another advantage of using these getter methods is that you could use
them in unit test for providing mocked objects and you do not have to
initialize the global variables.
Cheers,
Alex
Am 19.03.2014 12:37, schrieb François Suter:
> Hi Xavier,
>
>> I think the wrapper method is indeed a very good idea. Now what Kay
>> suggested is to assign it to a local variable. This will 1) keep the
>> type hinting and IDE autocomplete mechanism and 2) prevent many "same"
>> calls which indeed slow down the code.
>
> I see. I had not interpreted Kay's comment quite the right way. But it's
> still good to have this discussion I guess.
>
> Cheers
>
--
Alexander Stehlik
alexander.stehlik at gmail.com
More information about the TYPO3-team-core
mailing list