src/Controllers/AbstractController.php
protected function success(array $data, $code = 200)
    {
        $this->response->setStatusCode($code);
        $this->response->headers->add(['Content-Type' => 'application/json']);
        $this->response->setContent(json_encode(['success' => $data], JSON_PRETTY_PRINT));

        return $this->response;
    }
protected function success(array $data, $code = 200)
    {
        $this->response->setStatusCode($code);
        $this->response->headers->add(['Content-Type' => 'application/json']);
        $this->response->setContent(json_encode(['success' => $data], JSON_PRETTY_PRINT));

        return $this->response;
    }
protected function success ( array $ data , $ code = 200 ) { $ this -> response -> setStatusCode ( $ code ) ; $ this -> response -> headers -> add ( [ 'Content-Type' => 'application/json' ] ) ; $ this -> response -> setContent ( json_encode ( [ 'success' => $ data ] , JSON_PRETTY_PRINT ) ) ; return $ this -> response ; }
Get a success response json.

@param string[] $data
@param int      $code

@return \Symfony\Component\HttpFoundation\Response
Get a success response json .