Exemplo n.º 1
0
 /**
  * Return PHP code to translate dot to object/array getter.
  *
  * @example foo.bar return $foo->bar (if foo is an object), or $foo["bar"] if it's an array.
  *
  * @param array $match regex match
  *
  * @return string
  */
 protected static function convertVarPathCallback($match)
 {
     if (empty($match[1])) {
         return $match[0];
     }
     $var = ($match[0] === ',' ? ',' : '') . $match[1];
     foreach (explode('.', substr($match[2], 1)) as $name) {
         if (!empty($name)) {
             $var = CommonUtils::getGetter($var, $name, false);
         }
     }
     return $var;
 }