Passed
Push — master ( 03c468...179943 )
by Darko
11:56
created

AbstractCategorizer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A matched() 0 3 1
A noMatch() 0 1 1
A getPriority() 0 1 1
A shouldSkip() 0 1 1
1
<?php
2
namespace App\Services\Categorization\Categorizers;
3
use App\Services\Categorization\CategorizationResult;
4
use App\Services\Categorization\Contracts\CategorizerInterface;
5
use App\Services\Categorization\ReleaseContext;
6
abstract class AbstractCategorizer implements CategorizerInterface
7
{
8
    protected int $priority = 50;
9
    public function getPriority(): int { return $this->priority; }
10
    public function shouldSkip(ReleaseContext $context): bool { return false; }
11
    protected function matched(int $categoryId, float $confidence, string $matchedBy, array $debug = []): CategorizationResult
12
    {
13
        return new CategorizationResult($categoryId, $confidence, $matchedBy, $debug);
14
    }
15
    protected function noMatch(): CategorizationResult { return CategorizationResult::noMatch(); }
16
}
17