Utility/JsonParser.php
private function translatePathElement($path, &$paramsRef)
    {
        $dotPos   = strpos($path, '.');
        $currPath = $path;
        if($dotPos !== false)
        {
            $currPath = substr($path, 0, $dotPos);
        }

        if($currPath == '*')
        {
            //Hell begins
            if($dotPos !== false)
            {
                //create a new copy and merge everything from one level up
                $newParamsRef = array();
                foreach ($paramsRef as $subArray) {
                    if(is_array($subArray))
                    {
                        foreach ($subArray as $key => $value) {
                            if(isset($newParamsRef[$key]))
                            {
                                $newParamsRef[$key][] = $value;
                            }
                            else
                            {
                                if(is_array($value))
                                {
                                    $newParamsRef[$key] = $value;
                                }
                                else
                                {
                                    $newParamsRef[$key] = array($value);
                                }
                            }
                        }
                    }
                }
                return $this->translatePathElement(substr($path, $dotPos + 1), $newParamsRef);
            }
            else
            {
                return $paramsRef;
            }
        }
        if(($lbracktePos = strpos($currPath, '[')) !== false)
        {
            $subPath = substr($currPath, 0, $lbracktePos);
            $index   = intval(substr($currPath, $lbracktePos+1, -1));

            if(isset($paramsRef[$subPath]) && is_array($paramsRef[$subPath]) && isset($paramsRef[$subPath][$index]))
            {
                if($dotPos === false)
                {
                    return $paramsRef[$subPath][$index];
                }
                else
                {
                    return $this->translatePathElement(substr($path, $dotPos + 1), $paramsRef[$subPath][$index]);
                }
            }
        }
        else
        {
            if(isset($paramsRef[$currPath]))
            {
                if($dotPos === false)
                {
                    return $paramsRef[$currPath];
                }
                else
                {
                    return $this->translatePathElement(substr($path, $dotPos + 1), $paramsRef[$currPath]);
                }
            }
        }

        return null;
    }
private function translatePathElement($path, &$paramsRef)
    {
        $dotPos   = strpos($path, '.');
        $currPath = $path;
        if($dotPos !== false)
        {
            $currPath = substr($path, 0, $dotPos);
        }

        if($currPath == '*')
        {
            //Hell begins
            if($dotPos !== false)
            {
                //create a new copy and merge everything from one level up
                $newParamsRef = array();
                foreach ($paramsRef as $subArray) {
                    if(is_array($subArray))
                    {
                        foreach ($subArray as $key => $value) {
                            if(isset($newParamsRef[$key]))
                            {
                                $newParamsRef[$key][] = $value;
                            }
                            else
                            {
                                if(is_array($value))
                                {
                                    $newParamsRef[$key] = $value;
                                }
                                else
                                {
                                    $newParamsRef[$key] = array($value);
                                }
                            }
                        }
                    }
                }
                return $this->translatePathElement(substr($path, $dotPos + 1), $newParamsRef);
            }
            else
            {
                return $paramsRef;
            }
        }
        if(($lbracktePos = strpos($currPath, '[')) !== false)
        {
            $subPath = substr($currPath, 0, $lbracktePos);
            $index   = intval(substr($currPath, $lbracktePos+1, -1));

            if(isset($paramsRef[$subPath]) && is_array($paramsRef[$subPath]) && isset($paramsRef[$subPath][$index]))
            {
                if($dotPos === false)
                {
                    return $paramsRef[$subPath][$index];
                }
                else
                {
                    return $this->translatePathElement(substr($path, $dotPos + 1), $paramsRef[$subPath][$index]);
                }
            }
        }
        else
        {
            if(isset($paramsRef[$currPath]))
            {
                if($dotPos === false)
                {
                    return $paramsRef[$currPath];
                }
                else
                {
                    return $this->translatePathElement(substr($path, $dotPos + 1), $paramsRef[$currPath]);
                }
            }
        }

        return null;
    }
private function translatePathElement ( $ path , & $ paramsRef ) { $ dotPos = strpos ( $ path , '.' ) ; $ currPath = $ path ; if ( $ dotPos !== false ) { $ currPath = substr ( $ path , 0 , $ dotPos ) ; } if ( $ currPath == '*' ) { //Hell begins if ( $ dotPos !== false ) { //create a new copy and merge everything from one level up $ newParamsRef = array ( ) ; foreach ( $ paramsRef as $ subArray ) { if ( is_array ( $ subArray ) ) { foreach ( $ subArray as $ key => $ value ) { if ( isset ( $ newParamsRef [ $ key ] ) ) { $ newParamsRef [ $ key ] [ ] = $ value ; } else { if ( is_array ( $ value ) ) { $ newParamsRef [ $ key ] = $ value ; } else { $ newParamsRef [ $ key ] = array ( $ value ) ; } } } } } return $ this -> translatePathElement ( substr ( $ path , $ dotPos + 1 ) , $ newParamsRef ) ; } else { return $ paramsRef ; } } if ( ( $ lbracktePos = strpos ( $ currPath , '[' ) ) !== false ) { $ subPath = substr ( $ currPath , 0 , $ lbracktePos ) ; $ index = intval ( substr ( $ currPath , $ lbracktePos + 1 , - 1 ) ) ; if ( isset ( $ paramsRef [ $ subPath ] ) && is_array ( $ paramsRef [ $ subPath ] ) && isset ( $ paramsRef [ $ subPath ] [ $ index ] ) ) { if ( $ dotPos === false ) { return $ paramsRef [ $ subPath ] [ $ index ] ; } else { return $ this -> translatePathElement ( substr ( $ path , $ dotPos + 1 ) , $ paramsRef [ $ subPath ] [ $ index ] ) ; } } } else { if ( isset ( $ paramsRef [ $ currPath ] ) ) { if ( $ dotPos === false ) { return $ paramsRef [ $ currPath ] ; } else { return $ this -> translatePathElement ( substr ( $ path , $ dotPos + 1 ) , $ paramsRef [ $ currPath ] ) ; } } } return null ; }
Traverse through params according to path. This is a recursive function.

@param  string $path      path to traverse
@param  array  $paramsRef reference to the traversed array
@return mixed             found value/s
Traverse through params according to path . This is a recursive function .