Skip to content

Commit d87fc92

Browse files
committed
fix comment, add array-check to fill-methods (block)
+ small changes and style formatting
1 parent c835450 commit d87fc92

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/Endpoints/Block.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function __construct(Notion $notion, string $blockId)
1818
}
1919

2020
/**
21-
* Retrieve block children (as raw json-data)
21+
* Retrieve block children
2222
* url: https://api.notion.com/{version}/blocks/{block_id}/children
2323
* notion-api-docs: https://developers.notion.com/reference/get-block-children
2424
*
@@ -30,7 +30,7 @@ public function children(): Collection
3030
}
3131

3232
/**
33-
* Retrieve block children
33+
* Retrieve block children (as raw json-data)
3434
* url: https://api.notion.com/{version}/blocks/{block_id}/children
3535
* notion-api-docs: https://developers.notion.com/reference/get-block-children
3636
*

src/Entities/Blocks/Block.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ private function fillType(): void
4343

4444
private function fillContent(): void
4545
{
46-
if (Arr::exists($this->responseData, $this->type)) {
47-
$this->rawContent = $this->responseData[$this->type];
46+
if (Arr::exists($this->responseData, $this->getType())) {
47+
$this->rawContent = $this->responseData[$this->getType()];
4848
}
4949
}
5050

src/Entities/Properties/Property.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,20 @@ private function fillFromRaw(): void
3737

3838
private function fillType(): void
3939
{
40-
$this->type = $this->responseData['type'];
40+
if (Arr::exists($this->responseData, 'type')) {
41+
$this->type = $this->responseData['type'];
42+
}
4143
}
4244

4345
private function fillContent(): void
4446
{
45-
$this->rawContent = $this->responseData[$this->getType()];
47+
if (Arr::exists($this->responseData, $this->getType())) {
48+
$this->rawContent = $this->responseData[$this->getType()];
49+
}
4650
}
4751

48-
public function getTitle():string{
52+
public function getTitle(): string
53+
{
4954
return $this->title;
5055
}
5156

0 commit comments

Comments
 (0)