On 02/06/2022 22.32, Meredith Montgomery wrote:--- Synchronet 3.21d-Linux NewsLink 1.2
Sorry about the incomplete subject. I'm fixing that. I think I also understood a bit more about the code I'm asking, so I'm going to add an addendum. Sorry about this small mess.
Meredith Montgomery <mmont...@levado.to> writes:
The file
PayPal/Common/ReflectionUtil.php
--- whose content I show entirely below --- seems to be a class with
only static methods and static properties. Now, check the procedure
public static function propertyAnnotations($class, $propertyName)
It contains the chunk
if (!($refl =& self::$propertiesRefl[$class][$propertyName])) {
$getter = self::getter($class, $propertyName);
$refl = new \ReflectionMethod($class, $getter);
self::$propertiesRefl[$class][$propertyName] = $refl;
}
So $refl is instantiated and it is stored in
self::$propertiesRefl[$class][$propertyName]
which is a private static array. This means it cannot be acessed from
the ``outside''. Also, no other chunk in this class uses
$propertiesRefl.
Question. Why are they storing $refl if nobody uses it all, not even
the very class that defines it?
Actually, it clearly does use $refl. It's used right at the first lineYes, the inner code in this section will be called once for each
in the chunk above. It is set merely so the if-inner-code is only
executed once in its lifetime. Why? Can you just clarify to me what's going on this class? I'm not understanding it too clearly. Thank you!
combination of "class" and "propertyName".
The function will return a array of annotations (read a bit about it
here: https://www.educba.com/php-annotations )
It's most likely used to setup correct check for input values client
side and maybe even for post value validation.
--
//Aho
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 01:45:49 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
10 files (20,373K bytes) |
| Messages: | 264,188 |