Passed
Pull Request — master (#92)
by Fèvre
13:40 queued 08:22
created

ShopCategoryPresenter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCategoryUrlAttribute() 0 7 2
1
<?php
2
namespace Xetaravel\Models\Presenters;
3
4
trait ShopCategoryPresenter
5
{
6
    /**
7
     * Get the category url.
8
     *
9
     * @return string
10
     */
11
    public function getCategoryUrlAttribute(): string
12
    {
13
        if (!isset($this->slug)) {
14
            return '';
15
        }
16
17
        return route('shop.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

17
        return route('shop.category.show', ['slug' => $this->slug, 'id' => $this->/** @scrutinizer ignore-call */ getKey()]);
Loading history...
18
    }
19
}
20