src/Http/JsonResponse.php
public function prepareResult($success, $message, $code, $data, $errors) {
        $this->success = $success;
        $this->code = $code;
        $this->message = $message;
        if(is_null($this->data)) {
            $this->data = array();
        } else {
            if(!is_array($this->data)) {
                $old = $this->data;
                $this->data = array();
                array_push($this->data, $old);
            }
        }
        if(!is_null($data)) {
            if(is_array($data)) {
                $this->data = array_merge($this->data, $data);
            } else {
                array_push($this->data, $data);
            }
        }
        if(is_object($this->errors)) {
            $this->errors = Objects::attrToArray($this->errors);
        }
        if(is_string($this->errors) || is_numeric($this->errors)) {
            $err = $this->errors;
            $this->errors = array();
            $this->errors[0] = $err;
        }
        $this->errors = !is_null($errors) ? array_merge($this->errors, $errors) : $this->errors;
    }
public function prepareResult($success, $message, $code, $data, $errors) {
        $this->success = $success;
        $this->code = $code;
        $this->message = $message;
        if(is_null($this->data)) {
            $this->data = array();
        } else {
            if(!is_array($this->data)) {
                $old = $this->data;
                $this->data = array();
                array_push($this->data, $old);
            }
        }
        if(!is_null($data)) {
            if(is_array($data)) {
                $this->data = array_merge($this->data, $data);
            } else {
                array_push($this->data, $data);
            }
        }
        if(is_object($this->errors)) {
            $this->errors = Objects::attrToArray($this->errors);
        }
        if(is_string($this->errors) || is_numeric($this->errors)) {
            $err = $this->errors;
            $this->errors = array();
            $this->errors[0] = $err;
        }
        $this->errors = !is_null($errors) ? array_merge($this->errors, $errors) : $this->errors;
    }
public function prepareResult ( $ success , $ message , $ code , $ data , $ errors ) { $ this -> success = $ success ; $ this -> code = $ code ; $ this -> message = $ message ; if ( is_null ( $ this -> data ) ) { $ this -> data = array ( ) ; } else { if ( ! is_array ( $ this -> data ) ) { $ old = $ this -> data ; $ this -> data = array ( ) ; array_push ( $ this -> data , $ old ) ; } } if ( ! is_null ( $ data ) ) { if ( is_array ( $ data ) ) { $ this -> data = array_merge ( $ this -> data , $ data ) ; } else { array_push ( $ this -> data , $ data ) ; } } if ( is_object ( $ this -> errors ) ) { $ this -> errors = Objects :: attrToArray ( $ this -> errors ) ; } if ( is_string ( $ this -> errors ) || is_numeric ( $ this -> errors ) ) { $ err = $ this -> errors ; $ this -> errors = array ( ) ; $ this -> errors [ 0 ] = $ err ; } $ this -> errors = ! is_null ( $ errors ) ? array_merge ( $ this -> errors , $ errors ) : $ this -> errors ; }
Prepare an response
@param bool $success
@param string $message
@param int $code
@param mixed $data
@param array $errors
Prepare an response