Skip to content

Commit

Permalink
BaseEndpoint: Add support for sendItems().
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored May 15, 2020
1 parent ee25692 commit c55b0e6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Endpoint/BaseEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@ final public function sendOk(array $data = [], ?string $message = null, int $cod
}


/**
* @param mixed[] $items
* @param Paginator|null $paginator
* @param mixed[] $data
*/
final public function sendItems(array $items, ?Paginator $paginator = null, array $data = []): void
{
$return = ['items' => $items];

if ($paginator !== null) {
$return['paginator'] = $paginator;
}

$this->sendJson(array_merge($return, $data));
}


/**
* @param string $key
* @param string|null $message
Expand Down

0 comments on commit c55b0e6

Please sign in to comment.