public function set($pointer, &$array, $value)
    {
        $pointerArray = $this->parser->parse($pointer);

        $code = '$array';

        foreach ($pointerArray as $key) {
            if ($key === '-') {
                $code .= '[]';
                continue;
            }
            $code .= sprintf('[%s]', var_export($key, true));
        }

        $code .= '=$value;';

        // XXX: we shouldn't use eval expression
        // However without eval expression this operation will make unexpected reference.
        // If anyone know better way, please inform me :)
        eval($code);
    }
public function set($pointer, &$array, $value)
    {
        $pointerArray = $this->parser->parse($pointer);

        $code = '$array';

        foreach ($pointerArray as $key) {
            if ($key === '-') {
                $code .= '[]';
                continue;
            }
            $code .= sprintf('[%s]', var_export($key, true));
        }

        $code .= '=$value;';

        // XXX: we shouldn't use eval expression
        // However without eval expression this operation will make unexpected reference.
        // If anyone know better way, please inform me :)
        eval($code);
    }
public function set ( $ pointer , & $ array , $ value ) { $ pointerArray = $ this -> parser -> parse ( $ pointer ) ; $ code = '$array' ; foreach ( $ pointerArray as $ key ) { if ( $ key === '-' ) { $ code .= '[]' ; continue ; } $ code .= sprintf ( '[%s]' , var_export ( $ key , true ) ) ; } $ code .= '=$value;' ; // XXX: we shouldn't use eval expression // However without eval expression this operation will make unexpected reference. // If anyone know better way, please inform me :) eval ( $ code ) ; }
set pointed value

@param string $pointer JSON Pointer string
@param array  &$array   target array
@param mixed  $value   value to set

@throws Exception\SyntaxError
@throws Exception\NoneExistentValue
@SuppressWarnings(PHPMD.UnusedFormalParameter)
@SuppressWarnings(PHPMD.EvalExpression)
set pointed value