mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 19:16:37 +00:00
Applied PHP formatting rules
This commit is contained in:
@@ -4,23 +4,13 @@ namespace Grocy\Controllers;
|
||||
|
||||
class BaseApiController extends BaseController
|
||||
{
|
||||
protected $OpenApiSpec = null;
|
||||
|
||||
public function __construct(\DI\Container $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
}
|
||||
|
||||
protected $OpenApiSpec = null;
|
||||
|
||||
protected function getOpenApispec()
|
||||
{
|
||||
if($this->OpenApiSpec == null)
|
||||
{
|
||||
$this->OpenApiSpec = json_decode(file_get_contents(__DIR__ . '/../grocy.openapi.json'));
|
||||
}
|
||||
return $this->OpenApiSpec;
|
||||
}
|
||||
|
||||
protected function ApiResponse(\Psr\Http\Message\ResponseInterface $response, $data)
|
||||
{
|
||||
$response->getBody()->write(json_encode($data));
|
||||
@@ -34,8 +24,19 @@ class BaseApiController extends BaseController
|
||||
|
||||
protected function GenericErrorResponse(\Psr\Http\Message\ResponseInterface $response, $errorMessage, $status = 400)
|
||||
{
|
||||
return $response->withStatus($status)->withJson(array(
|
||||
return $response->withStatus($status)->withJson([
|
||||
'error_message' => $errorMessage
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getOpenApispec()
|
||||
{
|
||||
if ($this->OpenApiSpec == null)
|
||||
{
|
||||
$this->OpenApiSpec = json_decode(file_get_contents(__DIR__ . '/../grocy.openapi.json'));
|
||||
}
|
||||
|
||||
return $this->OpenApiSpec;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user