Passed
Push — 5.0.0 ( c86c37...f3ec4d )
by Fèvre
06:46
created

BlogCategoryPresenter::showUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xetaravel\Models\Presenters;
6
7
use Illuminate\Database\Eloquent\Casts\Attribute;
8
9
trait BlogCategoryPresenter
10
{
11
    /**
12
     * Get the category url.
13
     *
14
     * @return Attribute
15
     */
16
    protected function showUrl(): Attribute
17
    {
18
        return Attribute::make(
19
            get: fn () => route('blog.category.show', ['slug' => $this?->slug, 'id' => $this?->getKey()])
0 ignored issues
show
Bug introduced by
It seems like getKey() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
            get: fn () => route('blog.category.show', ['slug' => $this?->slug, 'id' => $this?->/** @scrutinizer ignore-call */ getKey()])
Loading history...
20
        );
21
    }
22
}
23