TermConversionArchive::getReversion()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Leonidas\Library\System\Schema\Term;
4
5
use Leonidas\Contracts\System\Schema\Term\TermConversionArchiveInterface;
6
use Leonidas\Library\System\Schema\AbstractEntityConversionArchive;
7
use WP_Term;
0 ignored issues
show
Bug introduced by
The type WP_Term was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class TermConversionArchive extends AbstractEntityConversionArchive implements TermConversionArchiveInterface
10
{
11
    protected array $conversions = [];
12
13
    protected array $reversions = [];
14
15
    public function getConversion(WP_Term $term): object
16
    {
17
        return $this->conversions[$this->hash($term)];
18
    }
19
20
    public function getReversion(object $entity): WP_Term
21
    {
22
        return $this->reversions[$this->hash($entity)];
23
    }
24
25
    public function archive(WP_Term $term, object $entity): void
26
    {
27
        $this->reversions[$this->hash($entity)] = $term;
28
        $this->conversions[$this->hash($term)] = $entity;
29
    }
30
}
31