ClassMetadata   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 6
eloc 14
dl 0
loc 75
ccs 9
cts 18
cp 0.5
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 5 1
A unserialize() 0 7 1
A setIndex() 0 3 1
A setCustomRepositoryName() 0 3 1
A getCustomRepositoryName() 0 3 1
A getIndex() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CCT\Component\ODMElasticsearch\Metadata;
6
7
use Metadata\ClassMetadata as BaseClassMetadata;
8
9
class ClassMetadata extends BaseClassMetadata
10
{
11
    public $preExtractMethods;
12
13
    /**
14
     * Elastic search index name and settings
15
     *
16
     * @var array | null
17
     */
18
    protected $index;
19
20
    /**
21
     * Class name of custom repository. Leave null to use default elastic search repository
22
     *
23
     * @var string | null
24
     */
25
    protected $customRepositoryName;
26
27
    /**
28
     * Serialize the metadata object. Useful for caching
29
     *
30
     * @return string
31
     */
32
    public function serialize()
33
    {
34
        return serialize(array(
35
            $this->preExtractMethods,
36
            parent::serialize(),
37
        ));
38
    }
39
40
    /**
41
     * Unserialize the metadata
42
     *
43
     * @param $str
44
     */
45
    public function unserialize($str)
46
    {
47
        $unserialized = unserialize($str);
48
49
        [$this->preExtractMethods, $parentStr] = $unserialized;
50
51
        parent::unserialize($parentStr);
52
    }
53
54
    /**
55
     * @return null|string
56
     */
57 4
    public function getCustomRepositoryName(): ?string
58
    {
59 4
        return $this->customRepositoryName;
60
    }
61
62
    /**
63
     * @param null|string $customRepositoryName
64
     */
65 13
    public function setCustomRepositoryName(?string $customRepositoryName): void
66
    {
67 13
        $this->customRepositoryName = $customRepositoryName;
68 13
    }
69
70
    /**
71
     * @return array|null
72
     */
73 5
    public function getIndex(): ?array
74
    {
75 5
        return $this->index;
76
    }
77
78
    /**
79
     * @param array|null $index
80
     */
81 13
    public function setIndex(?array $index): void
82
    {
83 13
        $this->index = $index;
84 13
    }
85
}
86