TermConversionArchive   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 20
ccs 0
cts 7
cp 0
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getReversion() 0 3 1
A archive() 0 4 1
A getConversion() 0 3 1
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