public function extract(callable $callback = null)
    {
        $this->response = Di::getDefault()->get('response');

        if ($callback === null) {
            $this->response->setContent(json_encode($this->result->toArray()));
        }

        else {
            $this->response->setContent($callback(
                json_encode($this->result->toArray())
            ));
        }

        $this->response->send();

    }
public function extract(callable $callback = null)
    {
        $this->response = Di::getDefault()->get('response');

        if ($callback === null) {
            $this->response->setContent(json_encode($this->result->toArray()));
        }

        else {
            $this->response->setContent($callback(
                json_encode($this->result->toArray())
            ));
        }

        $this->response->send();

    }
public function extract ( callable $ callback = null ) { $ this -> response = Di :: getDefault ( ) -> get ( 'response' ) ; if ( $ callback === null ) { $ this -> response -> setContent ( json_encode ( $ this -> result -> toArray ( ) ) ) ; } else { $ this -> response -> setContent ( $ callback ( json_encode ( $ this -> result -> toArray ( ) ) ) ) ; } $ this -> response -> send ( ) ; }
Extract result data to json

@param  callback|null $callback function to data
@return mixed
Extract result data to json