- Working on CLI modules
This commit is contained in:
1 parent
52c7407519
commit
41083c767a
10 files changed
+90
-4
No files matched your search
@@ -117,6 +117,22 @@ trait ControllerTrait {
|
||||
return new FileDownloadResponse($path, $code, $headers);
|
||||
}
|
||||
|
||||
public function renderCLI(ServerRequestInterface $request, mixed $data) : ResponseInterface
|
||||
{
|
||||
if ($data instanceof \JsonSerializable ) {
|
||||
return $this->renderJson(
|
||||
$data
|
||||
);
|
||||
}
|
||||
elseif ( is_array($data) ) {
|
||||
var_export($data);
|
||||
}
|
||||
|
||||
return $this->renderText(
|
||||
$data . PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
public function fromResponse(ResponseInterface $response)
|
||||
{
|
||||
if ( $response->getStatusCode() === 200 ) {
|
||||
|
||||
Reference in new issue
Block a user