Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Jan 11, 2025
1 parent adc84bc commit 33212a1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 30 deletions.
32 changes: 16 additions & 16 deletions src/Services/Includes/IncludingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(VJsonResource $resource)
}

/**
* Register includes using a query string
* Register includes using a query string.
*
* @param string|array|null $includes
*
Expand Down Expand Up @@ -56,10 +56,10 @@ public function registerIncludesUsingQueryString(string|array|null $includes): s
}

/**
* If true, then register the includes
* If true, then register the includes.
*
* @param bool $condition
* @param string|array|null $includes
* @param bool $condition
* @param string|array|null $includes
*
* @return $this
*/
Expand All @@ -73,9 +73,9 @@ public function registerIncludesUsingQueryStringWhen(bool $condition, string|arr
}

/**
* Parse the given include and make it ready to apply
* Parse the given include and make it ready to apply.
*
* @param string $include
* @param string $include
*
* @return array
*/
Expand Down Expand Up @@ -124,9 +124,9 @@ public function parseInclude(string $include): array
}

/**
* Apply the Includes on the related resource instance
* Apply the Includes on the related resource instance.
*
* @param Model $model
* @param Model $model
*
* @return $this
*/
Expand All @@ -149,7 +149,7 @@ public function applyRequestedIncludes(Model $model): self
}

/**
* Get the available includes list from resource instance
* Get the available includes list from resource instance.
*
* @return array
*/
Expand All @@ -159,9 +159,9 @@ protected function getAvailableIncludes(): array
}

/**
* Return the instance key using an include instance
* Return the instance key using an include instance.
*
* @param string|object $instance
* @param string|object $instance
*
* @return string
*/
Expand All @@ -173,7 +173,7 @@ protected function getInstanceKey(string|object $instance): string
}

/**
* Return Included data
* Return Included data.
*
* @return array
*/
Expand All @@ -183,9 +183,9 @@ public function getIncludedData(): array
}

/**
* Will merge included data to the given array
* Will merge included data to the given array.
*
* @param array $data
* @param array $data
*
* @return void
*/
Expand All @@ -195,8 +195,8 @@ public function mergeIncludedDataTo(array &$data): void
}

/**
* Return the list of registered actions
*
* Return the list of registered actions.
*
* @return array
*/
public function getRegisteredActions(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Services/Includes/IncludingServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getRequestedIncludesAsNull(): void
#[Test]
public function getRequestedIncludesAsCondition(): void
{
$this->service->registerIncludesUsingQueryStringWhen(true,'categories');
$this->service->registerIncludesUsingQueryStringWhen(true, 'categories');
self::assertEquals(
[CategoriesIncludes::class => []],
$this->resource->getRequestedIncludes()
Expand Down
11 changes: 2 additions & 9 deletions tests/Feature/Services/Includes/LimitActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@

namespace Hans\Valravn\Tests\Feature\Services\Includes;

use Hans\Valravn\Http\Resources\Contracts\VJsonResource;
use Hans\Valravn\Services\Includes\Actions\LimitAction;
use Hans\Valravn\Services\Includes\Actions\OrderAction;
use Hans\Valravn\Services\Includes\Actions\SelectAction;
use Hans\Valravn\Services\Includes\IncludingService;
use Hans\Valravn\Tests\Core\Factories\CategoryFactory;
use Hans\Valravn\Tests\Core\Factories\CommentFactory;
use Hans\Valravn\Tests\Core\Factories\PostFactory;
use Hans\Valravn\Tests\Core\Resources\Category\CategoryCollection;
use Hans\Valravn\Tests\Core\Resources\Post\PostResource;
use Hans\Valravn\Tests\Instances\Http\Includes\CategoriesIncludes;
use Hans\Valravn\Tests\Instances\Http\Includes\CommentsIncludes;
use Hans\Valravn\Tests\TestCase;
use Illuminate\Support\Collection;
use PHPUnit\Framework\Attributes\Test;
Expand Down Expand Up @@ -44,7 +37,7 @@ public function apply(): void

self::assertEquals(
[
'categories' => CategoryCollection::make($model->categories()->take(2)->get())
'categories' => CategoryCollection::make($model->categories()->take(2)->get()),
],
$data
);
Expand All @@ -60,7 +53,7 @@ public function applyWithNoParam(): void

self::assertEquals(
[
'categories' => CategoryCollection::make($model->categories)
'categories' => CategoryCollection::make($model->categories),
],
$data
);
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Services/Includes/OrderActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function apply(): void

self::assertEquals(
[
'categories' => CategoryCollection::make($model->categories)
'categories' => CategoryCollection::make($model->categories),
],
$data
);
Expand All @@ -53,7 +53,7 @@ public function applyDesc(): void

self::assertEquals(
[
'categories' => CategoryCollection::make($model->categories()->orderByDesc('id')->get())
'categories' => CategoryCollection::make($model->categories()->orderByDesc('id')->get()),
],
$data
);
Expand All @@ -69,7 +69,7 @@ public function applyWithNoParam(): void

self::assertEquals(
[
'categories' => CategoryCollection::make($model->categories)
'categories' => CategoryCollection::make($model->categories),
],
$data
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Services/Includes/SelectActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function applyWithNoParam(): void

self::assertEquals(
[
'categories' => CategoryCollection::make($model->categories)
'categories' => CategoryCollection::make($model->categories),
],
$data
);
Expand Down

0 comments on commit 33212a1

Please sign in to comment.