Skip to content

Commit bf93c78

Browse files
committed
Implement PaginatedInterface
1 parent b7ffd9c commit bf93c78

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

src/Paginated.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Phinch;
44

5-
class Paginated implements \JsonSerializable
5+
class Paginated implements PaginatedInterface
66
{
77
/**
88
* Paginated constructor.
@@ -43,15 +43,4 @@ public function results(): array
4343

4444
return array_shift($data);
4545
}
46-
47-
/**
48-
* @return false|mixed|string
49-
*/
50-
public function jsonSerialize(): mixed
51-
{
52-
return json_encode([
53-
'results' => $this->results(),
54-
'meta' => $this->meta(),
55-
], JSON_PRETTY_PRINT);
56-
}
5746
}

src/PaginatedInterface.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Phinch;
4+
5+
interface PaginatedInterface
6+
{
7+
/**
8+
* @return array
9+
*/
10+
public function results(): array;
11+
12+
/**
13+
* @return array
14+
*/
15+
public function meta(): array;
16+
}

0 commit comments

Comments
 (0)