public function success(int $statusCode, string $message, $data = null): JsonResponse
    {

        $this->setStatusCode($statusCode);

        $this->setMessage($message);

        $this->setData($data);


        $content['message'] = $this->getMessage();


        if (null !== $this->getCode()) {
            $content['code'] = $this->getCode();
        }


        $content['status_code'] = $this->getStatusCode();


        if (null !== $this->getData() && $this->getErrors() !== $this->getData()) {
            $content['data'] = $this->getData();
        }

        if (null !== $this->getErrors()) {
            $content['errors'] = $this->getErrors();
        }

        $content += $this->Hypermedia;

        return new JsonResponse($content, $this->getHttpStatusCode() ?: $this->getStatusCode());
    }
public function success(int $statusCode, string $message, $data = null): JsonResponse
    {

        $this->setStatusCode($statusCode);

        $this->setMessage($message);

        $this->setData($data);


        $content['message'] = $this->getMessage();


        if (null !== $this->getCode()) {
            $content['code'] = $this->getCode();
        }


        $content['status_code'] = $this->getStatusCode();


        if (null !== $this->getData() && $this->getErrors() !== $this->getData()) {
            $content['data'] = $this->getData();
        }

        if (null !== $this->getErrors()) {
            $content['errors'] = $this->getErrors();
        }

        $content += $this->Hypermedia;

        return new JsonResponse($content, $this->getHttpStatusCode() ?: $this->getStatusCode());
    }
public function success ( int $ statusCode , string $ message , $ data = null ) : JsonResponse { $ this -> setStatusCode ( $ statusCode ) ; $ this -> setMessage ( $ message ) ; $ this -> setData ( $ data ) ; $ content [ 'message' ] = $ this -> getMessage ( ) ; if ( null !== $ this -> getCode ( ) ) { $ content [ 'code' ] = $ this -> getCode ( ) ; } $ content [ 'status_code' ] = $ this -> getStatusCode ( ) ; if ( null !== $ this -> getData ( ) && $ this -> getErrors ( ) !== $ this -> getData ( ) ) { $ content [ 'data' ] = $ this -> getData ( ) ; } if ( null !== $ this -> getErrors ( ) ) { $ content [ 'errors' ] = $ this -> getErrors ( ) ; } $ content += $ this -> Hypermedia ; return new JsonResponse ( $ content , $ this -> getHttpStatusCode ( ) ? : $ this -> getStatusCode ( ) ) ; }
Public Success Method.

@param  int    $statusCode
@param  string $message
@param null    $data

@return JsonResponse
@throws \Songshenzong\Api\Exception\ApiException
Public Success Method .