Skip to content

Commit ceb61fe

Browse files
authored
Apply fixes from StyleCI (#166)
1 parent 8f98375 commit ceb61fe

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

src/Endpoints/Page.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313
class Page extends Endpoint
1414
{
15-
1615
/**
1716
* @var ?string
1817
*/
@@ -25,12 +24,12 @@ public function __construct(Notion $notion, string $pageId)
2524
}
2625

2726
/**
28-
* Retrieve a page property item
29-
*
27+
* Retrieve a page property item.
28+
*
3029
* @url https://api.notion.com/{version}/pages/{page_id}/properties/{property_id} [get]
3130
*
3231
* @reference https://developers.notion.com/reference/retrieve-a-page-property.
33-
*
32+
*
3433
* @param string $propertyId
3534
* @return Page
3635
*
@@ -40,7 +39,7 @@ public function __construct(Notion $notion, string $pageId)
4039
public function property(string $propertyId): Property
4140
{
4241
$response = $this->get(
43-
$this->url(Endpoint::PAGES . '/' . $this->pageId . '/' . 'properties' . '/' . urlencode($propertyId))
42+
$this->url(Endpoint::PAGES.'/'.$this->pageId.'/'.'properties'.'/'.urlencode($propertyId))
4443
);
4544

4645
return Property::fromResponse(

src/Macros/PestHttpRecorder.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class PestHttpRecorder
1414
public static function register()
1515
{
1616
Http::macro('recordAndFakeLater', function (array|string $urls = ['*']) {
17-
if (!is_array($urls)) {
17+
if (! is_array($urls)) {
1818
$urls = [$urls];
1919
}
2020

@@ -73,7 +73,9 @@ public function handle(Request $request)
7373
$payload = ($method === 'get') ? ($urlInfo['query'] ?? null) : $request->body();
7474
$queryName = array_pop($this->requestNames) ?? ($payload ? hash('adler32', $payload) : '');
7575

76-
if ($queryName != '') $queryName = '_' . $queryName;
76+
if ($queryName != '') {
77+
$queryName = '_'.$queryName;
78+
}
7779

7880
$fileName = "{$method}_{$name}{$queryName}.json";
7981
$directoryPath = "tests/{$this->snapshotDirectory}";
@@ -82,7 +84,7 @@ public function handle(Request $request)
8284
// filter out Notion API Token Header
8385
$header = Arr::except($header, ['Authorization']);
8486

85-
if ($forceRecording || !File::exists($filePath)) {
87+
if ($forceRecording || ! File::exists($filePath)) {
8688
File::makeDirectory($directoryPath, 0744, true, true);
8789

8890
$client = new Client();

src/Notion.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public function getConnection(): ?PendingRequest
238238
*/
239239
public function checkValidVersion(string $version): void
240240
{
241-
if (!$this->validVersions->contains($version)) {
241+
if (! $this->validVersions->contains($version)) {
242242
throw HandlingException::instance('Invalid version for Notion-API endpoint', ['invalidVersion' => $version]);
243243
}
244244
}

tests/RecordedEndpointPageTest.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<?php
22

3-
use Carbon\Carbon;
4-
use FiveamCode\LaravelNotionApi\Entities\Collections\CommentCollection;
5-
use FiveamCode\LaravelNotionApi\Entities\Comment;
63
use FiveamCode\LaravelNotionApi\Entities\Properties\Property;
7-
use FiveamCode\LaravelNotionApi\Entities\PropertyItems\RichText;
8-
use FiveamCode\LaravelNotionApi\Exceptions\NotionException;
94
use Illuminate\Support\Facades\Http;
105

116
$httpRecorder = null;
@@ -18,16 +13,16 @@
1813
});
1914

2015
it('should fetch specific property items of a page', function () {
21-
2216
$this->httpRecorder->nameForNextRequest('database-for-properties');
2317
$databaseStructure = \Notion::databases()->find('cdd4befe814144f7b1eecb9c123bd4fb');
2418

2519
$propertyKeys = $databaseStructure->getProperties()->map(fn ($o) => $o->getTitle());
2620

2721
foreach ($propertyKeys as $propertyKey) {
2822
try {
29-
30-
if ($propertyKey == 'Rollup' || $propertyKey == 'Person' || $propertyKey == 'Name') continue;
23+
if ($propertyKey == 'Rollup' || $propertyKey == 'Person' || $propertyKey == 'Name') {
24+
continue;
25+
}
3126
$id = $databaseStructure->getProperty($propertyKey)->getId();
3227
$property = \Notion::page('f1884dca3885460e93f52bf4da7cce8e')->property($id);
3328

0 commit comments

Comments
 (0)