Skip to content

Commit a58b905

Browse files
committed
renamed / condensed collect methods
1 parent fd0fc5d commit a58b905

File tree

4 files changed

+2
-25
lines changed

4 files changed

+2
-25
lines changed

src/Endpoints/Block.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,10 @@ public function __construct(Notion $notion, string $blockId)
2525
* @return BlockCollection
2626
*/
2727
public function children(): BlockCollection
28-
{
29-
return $this->collectChildren();
30-
}
31-
32-
private function collectChildren(): BlockCollection
3328
{
3429
$response = $this->get(
3530
$this->url(Endpoint::BLOCKS . "/" . $this->blockId . "/children" . "?{$this->buildPaginationQuery()}")
3631
);
37-
if (!$response->ok())
38-
throw HandlingException::instance("Block not found.", ["blockId" => $this->blockId]);
3932

4033
return new BlockCollection($response->json());
4134
}

src/Endpoints/Databases.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ class Databases extends Endpoint implements EndpointInterface
2828
* @return DatabaseCollection
2929
*/
3030
public function all(): DatabaseCollection
31-
{
32-
return $this->collect();
33-
}
34-
35-
36-
// TODO rename this function - receive, access, fetch?
37-
private function collect(): DatabaseCollection
3831
{
3932
$resultData = $this->getJson($this->url(Endpoint::DATABASES) . "?{$this->buildPaginationQuery()}");
4033
return new DatabaseCollection($resultData);

src/Endpoints/Users.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,10 @@ class Users extends Endpoint implements EndpointInterface
2121
*/
2222
public function all(): UserCollection
2323
{
24-
return $this->collect();
25-
}
26-
27-
private function collect(): UserCollection{
2824
$result = $this->get(
2925
$this->url(Endpoint::USERS . "?{$this->buildPaginationQuery()}")
3026
);
31-
27+
3228
return new UserCollection($result->json());
3329
}
3430

src/Entities/Collections/EntityCollection.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,11 @@ protected function fillResult()
5555
}
5656

5757

58-
public function getRaw(): array
58+
public function getRawResponse(): array
5959
{
6060
return $this->responseData;
6161
}
6262

63-
public function asRaw(): array
64-
{
65-
return $this->rawResults;
66-
}
67-
6863
public function asCollection(): Collection
6964
{
7065
return $this->collection;

0 commit comments

Comments
 (0)