public function toJson()
    {
        $response = new Doozr_Base_Response_Rest();
        $response
            ->status(Doozr_Base_Response_Rest::STATUS_ERROR)
            ->message($this->getMessage())
            ->data(array('error' => $this->getError()));

        $data = $response->getData();

        // Check token exchange required then inject
        if ($this->getToken() !== null) {
            $data['security'] = array('token' => $this->getToken());
        }

        // Now here is the interesting part in this logic ...
        if (true === DOOZR_DEBUGGING) {
            // add debug information!
            $data['meta'] = array(
                'message' => $this->getMessage(),
                'code'    => $this->getCode(),
                'file'    => $this->getFile(),
                'line'    => $this->getLine(),
            );
        }

        $response->setData($data);

        return $response->toJson();
    }
public function toJson()
    {
        $response = new Doozr_Base_Response_Rest();
        $response
            ->status(Doozr_Base_Response_Rest::STATUS_ERROR)
            ->message($this->getMessage())
            ->data(array('error' => $this->getError()));

        $data = $response->getData();

        // Check token exchange required then inject
        if ($this->getToken() !== null) {
            $data['security'] = array('token' => $this->getToken());
        }

        // Now here is the interesting part in this logic ...
        if (true === DOOZR_DEBUGGING) {
            // add debug information!
            $data['meta'] = array(
                'message' => $this->getMessage(),
                'code'    => $this->getCode(),
                'file'    => $this->getFile(),
                'line'    => $this->getLine(),
            );
        }

        $response->setData($data);

        return $response->toJson();
    }
public function toJson ( ) { $ response = new Doozr_Base_Response_Rest ( ) ; $ response -> status ( Doozr_Base_Response_Rest :: STATUS_ERROR ) -> message ( $ this -> getMessage ( ) ) -> data ( array ( 'error' => $ this -> getError ( ) ) ) ; $ data = $ response -> getData ( ) ; // Check token exchange required then inject if ( $ this -> getToken ( ) !== null ) { $ data [ 'security' ] = array ( 'token' => $ this -> getToken ( ) ) ; } // Now here is the interesting part in this logic ... if ( true === DOOZR_DEBUGGING ) { // add debug information! $ data [ 'meta' ] = array ( 'message' => $ this -> getMessage ( ) , 'code' => $ this -> getCode ( ) , 'file' => $ this -> getFile ( ) , 'line' => $ this -> getLine ( ) , ) ; } $ response -> setData ( $ data ) ; return $ response -> toJson ( ) ; }
Exports current state as json for API responses.

@author Benjamin Carl <opensource@clickalicious.de>
@return array The response for the API
@access public
Exports current state as json for API responses .