SearchAspect   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
getResults() 0 1 ?
A getType() 0 14 2
1
<?php
2
3
namespace Spatie\Searchable;
4
5
use Illuminate\Support\Collection;
6
use Illuminate\Support\Str;
7
8
abstract class SearchAspect
9
{
10
    abstract public function getResults(string $term): Collection;
11
12
    public function getType(): string
13
    {
14
        if (isset(static::$searchType)) {
15
            return static::$searchType;
16
        }
17
18
        $className = class_basename(static::class);
19
20
        $type = Str::before($className, 'SearchAspect');
21
22
        $type = Str::snake(Str::plural($type));
23
24
        return Str::plural($type);
25
    }
26
}
27