src/DebugBar/OpenHandler.php
public function handle($request = null, $echo = true, $sendHeader = true)
    {
        if ($request === null) {
            $request = $_REQUEST;
        }

        $op = 'find';
        if (isset($request['op'])) {
            $op = $request['op'];
            if (!in_array($op, array('find', 'get', 'clear'))) {
                throw new DebugBarException("Invalid operation '{$request['op']}'");
            }
        }

        if ($sendHeader) {
            $this->debugBar->getHttpDriver()->setHeaders(array(
                    'Content-Type' => 'application/json'
                ));
        }

        $response = json_encode(call_user_func(array($this, $op), $request));
        if ($echo) {
            echo $response;
        }
        return $response;
    }
public function handle($request = null, $echo = true, $sendHeader = true)
    {
        if ($request === null) {
            $request = $_REQUEST;
        }

        $op = 'find';
        if (isset($request['op'])) {
            $op = $request['op'];
            if (!in_array($op, array('find', 'get', 'clear'))) {
                throw new DebugBarException("Invalid operation '{$request['op']}'");
            }
        }

        if ($sendHeader) {
            $this->debugBar->getHttpDriver()->setHeaders(array(
                    'Content-Type' => 'application/json'
                ));
        }

        $response = json_encode(call_user_func(array($this, $op), $request));
        if ($echo) {
            echo $response;
        }
        return $response;
    }
public function handle ( $ request = null , $ echo = true , $ sendHeader = true ) { if ( $ request === null ) { $ request = $ _REQUEST ; } $ op = 'find' ; if ( isset ( $ request [ 'op' ] ) ) { $ op = $ request [ 'op' ] ; if ( ! in_array ( $ op , array ( 'find' , 'get' , 'clear' ) ) ) { throw new DebugBarException ( "Invalid operation '{$request['op']}'" ) ; } } if ( $ sendHeader ) { $ this -> debugBar -> getHttpDriver ( ) -> setHeaders ( array ( 'Content-Type' => 'application/json' ) ) ; } $ response = json_encode ( call_user_func ( array ( $ this , $ op ) , $ request ) ) ; if ( $ echo ) { echo $ response ; } return $ response ; }
Handles the current request

@param array $request Request data
@param bool $echo
@param bool $sendHeader
@return string
@throws DebugBarException
Handles the current request