Skip to content

Commit fc79f12

Browse files
mechelonStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 973b154 commit fc79f12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+866
-1137
lines changed

config/config.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

33
return [
4-
/**
5-
* The default Notion API version to use.
6-
*/
7-
'version' => 'v1',
4+
/**
5+
* The default Notion API version to use.
6+
*/
7+
'version' => 'v1',
88

9-
/**
10-
* Your Notion API token.
11-
*/
12-
'notion-api-token' => env('NOTION_API_TOKEN', '')
13-
];
9+
/**
10+
* Your Notion API token.
11+
*/
12+
'notion-api-token' => env('NOTION_API_TOKEN', ''),
13+
];

src/Endpoints/Block.php

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
use FiveamCode\LaravelNotionApi\Notion;
1010

1111
/**
12-
* Class Block
13-
* @package FiveamCode\LaravelNotionApi\Endpoints
12+
* Class Block.
1413
*/
1514
class Block extends Endpoint
1615
{
@@ -21,8 +20,10 @@ class Block extends Endpoint
2120

2221
/**
2322
* Block constructor.
24-
* @param Notion $notion
25-
* @param string $blockId
23+
*
24+
* @param Notion $notion
25+
* @param string $blockId
26+
*
2627
* @throws HandlingException
2728
* @throws \FiveamCode\LaravelNotionApi\Exceptions\LaravelNotionAPIException
2829
*/
@@ -35,18 +36,18 @@ public function __construct(Notion $notion, string $blockId)
3536
/**
3637
* Retrieve a block
3738
* url: https://api.notion.com/{version}/blocks/{block_id}
38-
* notion-api-docs: https://developers.notion.com/reference/retrieve-a-block
39+
* notion-api-docs: https://developers.notion.com/reference/retrieve-a-block.
3940
*
40-
* @param string $blockId
41+
* @param string $blockId
4142
* @return BlockEntity
43+
*
4244
* @throws HandlingException
4345
* @throws NotionException
4446
*/
4547
public function retrieve(): BlockEntity
4648
{
47-
4849
$response = $this->get(
49-
$this->url(Endpoint::BLOCKS . '/' . $this->blockId)
50+
$this->url(Endpoint::BLOCKS.'/'.$this->blockId)
5051
);
5152

5253
return BlockEntity::fromResponse($response->json());
@@ -55,16 +56,17 @@ public function retrieve(): BlockEntity
5556
/**
5657
* Retrieve block children
5758
* url: https://api.notion.com/{version}/blocks/{block_id}/children [get]
58-
* notion-api-docs: https://developers.notion.com/reference/get-block-children
59+
* notion-api-docs: https://developers.notion.com/reference/get-block-children.
5960
*
6061
* @return BlockCollection
62+
*
6163
* @throws HandlingException
6264
* @throws NotionException
6365
*/
6466
public function children(): BlockCollection
6567
{
6668
$response = $this->get(
67-
$this->url(Endpoint::BLOCKS . '/' . $this->blockId . '/children' . "?{$this->buildPaginationQuery()}")
69+
$this->url(Endpoint::BLOCKS.'/'.$this->blockId.'/children'."?{$this->buildPaginationQuery()}")
6870
);
6971

7072
return new BlockCollection($response->json());
@@ -73,58 +75,58 @@ public function children(): BlockCollection
7375
/**
7476
* Append one Block or an array of Blocks
7577
* url: https://api.notion.com/{version}/blocks/{block_id}/children [patch]
76-
* notion-api-docs: https://developers.notion.com/reference/patch-block-children
78+
* notion-api-docs: https://developers.notion.com/reference/patch-block-children.
7779
*
7880
* @return FiveamCode\LaravelNotionApi\Entities\Blocks\Block
81+
*
7982
* @throws HandlingException
8083
*/
8184
public function append(array|BlockEntity $appendices): BlockEntity
8285
{
83-
if (!is_array($appendices)) {
86+
if (! is_array($appendices)) {
8487
$appendices = [$appendices];
8588
}
8689
$children = [];
8790

8891
foreach ($appendices as $block) {
8992
$children[] = [
90-
"object" => "block",
91-
"type" => $block->getType(),
92-
$block->getType() => $block->getRawContent()
93+
'object' => 'block',
94+
'type' => $block->getType(),
95+
$block->getType() => $block->getRawContent(),
9396
];
9497
}
9598

9699
$body = [
97-
"children" => $children
100+
'children' => $children,
98101
];
99102

100-
101103
$response = $this->patch(
102-
$this->url(Endpoint::BLOCKS . '/' . $this->blockId . '/children' . ""),
104+
$this->url(Endpoint::BLOCKS.'/'.$this->blockId.'/children'.''),
103105
$body
104106
);
105107

106108
return new BlockEntity($response->json());
107109
}
108110

109-
110111
/**
111-
* Update one specific Block
112+
* Update one specific Block
112113
* url: https://api.notion.com/{version}/blocks/{block_id} [patch]
113-
* notion-api-docs: https://developers.notion.com/reference/update-a-block
114+
* notion-api-docs: https://developers.notion.com/reference/update-a-block.
114115
*
115116
* @return FiveamCode\LaravelNotionApi\Entities\Blocks\Block
117+
*
116118
* @throws HandlingException
117119
*/
118120
public function update(BlockEntity $block): BlockEntity
119121
{
120122
$body = [
121-
"object" => "block",
122-
"type" => $block->getType(),
123-
$block->getType() => $block->getRawContent()
123+
'object' => 'block',
124+
'type' => $block->getType(),
125+
$block->getType() => $block->getRawContent(),
124126
];
125127

126128
$response = $this->patch(
127-
$this->url(Endpoint::BLOCKS . '/' . $this->blockId . ""),
129+
$this->url(Endpoint::BLOCKS.'/'.$this->blockId.''),
128130
$body
129131
);
130132

src/Endpoints/Database.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
use Illuminate\Support\Collection;
1010

1111
/**
12-
* Class Database
13-
* @package FiveamCode\LaravelNotionApi\Endpoints
12+
* Class Database.
1413
*/
1514
class Database extends Endpoint
1615
{
@@ -29,11 +28,12 @@ class Database extends Endpoint
2928
*/
3029
private Collection $sorts;
3130

32-
3331
/**
3432
* Database constructor.
35-
* @param string $databaseId
36-
* @param Notion $notion
33+
*
34+
* @param string $databaseId
35+
* @param Notion $notion
36+
*
3737
* @throws \FiveamCode\LaravelNotionApi\Exceptions\HandlingException
3838
* @throws \FiveamCode\LaravelNotionApi\Exceptions\LaravelNotionAPIException
3939
*/
@@ -49,28 +49,33 @@ public function __construct(string $databaseId, Notion $notion)
4949

5050
/**
5151
* @return PageCollection
52+
*
5253
* @throws \FiveamCode\LaravelNotionApi\Exceptions\HandlingException
5354
* @throws \FiveamCode\LaravelNotionApi\Exceptions\NotionException
5455
*/
5556
public function query(): PageCollection
5657
{
5758
$postData = [];
5859

59-
if ($this->sorts->isNotEmpty())
60+
if ($this->sorts->isNotEmpty()) {
6061
$postData['sorts'] = Sorting::sortQuery($this->sorts);
62+
}
6163

62-
if ($this->filter->isNotEmpty())
63-
$postData['filter']['or'] = Filter::filterQuery($this->filter); // TODO Compound filters!
64+
if ($this->filter->isNotEmpty()) {
65+
$postData['filter']['or'] = Filter::filterQuery($this->filter);
66+
} // TODO Compound filters!
6467

65-
if ($this->startCursor !== null)
68+
if ($this->startCursor !== null) {
6669
$postData['start_cursor'] = $this->startCursor;
70+
}
6771

68-
if ($this->pageSize !== null)
72+
if ($this->pageSize !== null) {
6973
$postData['page_size'] = $this->pageSize;
74+
}
7075

7176
$response = $this
7277
->post(
73-
$this->url(Endpoint::DATABASES . "/{$this->databaseId}/query"),
78+
$this->url(Endpoint::DATABASES."/{$this->databaseId}/query"),
7479
$postData
7580
)
7681
->json();
@@ -79,22 +84,24 @@ public function query(): PageCollection
7984
}
8085

8186
/**
82-
* @param Collection $filter
87+
* @param Collection $filter
8388
* @return $this
8489
*/
8590
public function filterBy(Collection $filter): Database
8691
{
8792
$this->filter = $filter;
93+
8894
return $this;
8995
}
9096

9197
/**
92-
* @param Collection $sorts
98+
* @param Collection $sorts
9399
* @return $this
94100
*/
95101
public function sortBy(Collection $sorts): Database
96102
{
97103
$this->sorts = $sorts;
104+
98105
return $this;
99106
}
100107
}

src/Endpoints/Databases.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,48 @@
77
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
88
use FiveamCode\LaravelNotionApi\Exceptions\NotionException;
99

10-
1110
/**
12-
* Class Databases
11+
* Class Databases.
1312
*
1413
* This endpoint is not recommended by Notion anymore.
1514
* Use the search() endpoint instead.
16-
*
17-
* @package FiveamCode\LaravelNotionApi\Endpoints
1815
*/
1916
class Databases extends Endpoint implements EndpointInterface
2017
{
2118
/**
2219
* List databases
2320
* url: https://api.notion.com/{version}/databases
24-
* notion-api-docs: https://developers.notion.com/reference/get-databases
21+
* notion-api-docs: https://developers.notion.com/reference/get-databases.
2522
*
2623
* @return DatabaseCollection
24+
*
2725
* @throws HandlingException
2826
* @throws NotionException
27+
*
2928
* @deprecated
3029
*/
3130
public function all(): DatabaseCollection
3231
{
33-
$resultData = $this->getJson($this->url(Endpoint::DATABASES) . "?{$this->buildPaginationQuery()}");
32+
$resultData = $this->getJson($this->url(Endpoint::DATABASES)."?{$this->buildPaginationQuery()}");
33+
3434
return new DatabaseCollection($resultData);
3535
}
3636

3737
/**
3838
* Retrieve a database
3939
* url: https://api.notion.com/{version}/databases/{database_id}
40-
* notion-api-docs: https://developers.notion.com/reference/retrieve-a-database
40+
* notion-api-docs: https://developers.notion.com/reference/retrieve-a-database.
4141
*
42-
* @param string $databaseId
42+
* @param string $databaseId
4343
* @return Database
44+
*
4445
* @throws HandlingException
4546
* @throws NotionException
4647
*/
4748
public function find(string $databaseId): Database
4849
{
4950
$result = $this
50-
->getJson($this->url(Endpoint::DATABASES . "/{$databaseId}"));
51+
->getJson($this->url(Endpoint::DATABASES."/{$databaseId}"));
5152

5253
return new Database($result);
5354
}

0 commit comments

Comments
 (0)