Skip to content

Commit

Permalink
Implement PaginatedInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
hotmeteor committed Sep 6, 2022
1 parent b7ffd9c commit bf93c78
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
13 changes: 1 addition & 12 deletions src/Paginated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Phinch;

class Paginated implements \JsonSerializable
class Paginated implements PaginatedInterface
{
/**
* Paginated constructor.
Expand Down Expand Up @@ -43,15 +43,4 @@ public function results(): array

return array_shift($data);
}

/**
* @return false|mixed|string
*/
public function jsonSerialize(): mixed
{
return json_encode([
'results' => $this->results(),
'meta' => $this->meta(),
], JSON_PRETTY_PRINT);
}
}
16 changes: 16 additions & 0 deletions src/PaginatedInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Phinch;

interface PaginatedInterface
{
/**
* @return array
*/
public function results(): array;

/**
* @return array
*/
public function meta(): array;
}

0 comments on commit bf93c78

Please sign in to comment.