From a033c24313852146207f96f8f33548ae91d35e90 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 7 Dec 2022 09:53:55 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Endpoints/Database.php | 5 ++--- src/Query/Sorting.php | 2 +- tests/NotionApiTest.php | 1 + tests/Pest.php | 2 +- tests/SortingTest.php | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Endpoints/Database.php b/src/Endpoints/Database.php index 23b6f22..eeb7e96 100644 --- a/src/Endpoints/Database.php +++ b/src/Endpoints/Database.php @@ -97,16 +97,15 @@ public function filterBy(Collection $filter): Database } /** - * @param Collection|Sorting $sorts + * @param Collection|Sorting $sorts * @return Database $this * * @throws HandlingException - * */ public function sortBy(Sorting|Collection $sorts): Database { $sortInstance = get_class($sorts); - switch($sortInstance) { + switch ($sortInstance) { case Sorting::class: $this->sorts->push($sorts); break; diff --git a/src/Query/Sorting.php b/src/Query/Sorting.php index 817b55f..113724d 100644 --- a/src/Query/Sorting.php +++ b/src/Query/Sorting.php @@ -100,7 +100,7 @@ public static function sortQuery(Sorting|Collection $sortings): array { $querySortings = new Collection(); - if($sortings instanceof Collection) { + if ($sortings instanceof Collection) { $sortings->each(function (Sorting $sorting) use ($querySortings) { $querySortings->push($sorting->toArray()); }); diff --git a/tests/NotionApiTest.php b/tests/NotionApiTest.php index 32b9468..6dea0e9 100644 --- a/tests/NotionApiTest.php +++ b/tests/NotionApiTest.php @@ -6,6 +6,7 @@ use FiveamCode\LaravelNotionApi\NotionFacade; use Illuminate\Support\Collection; use Orchestra\Testbench\TestCase as Orchestra; + /** * Class EndpointPageTest. * diff --git a/tests/Pest.php b/tests/Pest.php index 29ba777..047ff43 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -2,4 +2,4 @@ use FiveamCode\LaravelNotionApi\Tests\NotionApiTest; -uses(NotionApiTest::class)->in(__DIR__); \ No newline at end of file +uses(NotionApiTest::class)->in(__DIR__); diff --git a/tests/SortingTest.php b/tests/SortingTest.php index c99741a..410c181 100644 --- a/tests/SortingTest.php +++ b/tests/SortingTest.php @@ -1,22 +1,22 @@ assertEquals($expectedSortQuery, json_encode(Sorting::sortQuery($sortBy)));}); + $sortBy = Sorting::propertySort('Birth year', 'ascending'); + $this->assertEquals($expectedSortQuery, json_encode(Sorting::sortQuery($sortBy))); +}); it('can sort by multiple properties', function () { $expectedSortQuery = '[{"timestamp":"created_time","direction":"ascending"},{"property":"Birth year","direction":"ascending"}]'; $sortings = new Collection(); - $sortings->add(Sorting::timestampSort("created_time", "ascending")); - $sortings->add(Sorting::propertySort("Birth year", "ascending")); + $sortings->add(Sorting::timestampSort('created_time', 'ascending')); + $sortings->add(Sorting::propertySort('Birth year', 'ascending')); $this->assertEquals($expectedSortQuery, json_encode(Sorting::sortQuery($sortings))); }); @@ -27,4 +27,4 @@ Notion::database('8284f3ff77e24d4a939d19459e4d6bdc') ->sortBy(new stdClass()) ->query(); -}); \ No newline at end of file +});