Passed
Push — trunk ( 325349...f71779 )
by Christian
12:37 queued 16s
created

SearchFieldConfig   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 28
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isCustomField() 0 3 1
A getRanking() 0 3 1
A getField() 0 3 1
A __construct() 0 5 1
A tokenize() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Elasticsearch\Product;
4
5
use Shopware\Core\Framework\Log\Package;
6
7
#[Package('core')]
8
class SearchFieldConfig
9
{
10
    public function __construct(
11
        private readonly string $field,
12
        private readonly int $ranking,
13
        private readonly bool $tokenize
14
    ) {
15
    }
16
17
    public function tokenize(): bool
18
    {
19
        return $this->tokenize;
20
    }
21
22
    public function getRanking(): int
23
    {
24
        return $this->ranking;
25
    }
26
27
    public function getField(): string
28
    {
29
        return $this->field;
30
    }
31
32
    public function isCustomField(): bool
33
    {
34
        return str_contains($this->field, 'customFields');
35
    }
36
}
37