Passed
Push — master ( 240c83...03f39b )
by Mathias
06:41
created

ContactImageMetadata   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContact() 0 3 1
A preRemove() 0 3 1
A setContact() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cv\Entity;
6
7
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
8
use Core\Entity\ImageMetadata;
9
10
/**
11
 * Class ContactImageMetadata
12
 * @ODM\EmbeddedDocument
13
 * @ODM\HasLifecycleCallbacks()
14
 * @package Cv\Entity
15
 */
16
class ContactImageMetadata extends ImageMetadata
17
{
18
    /**
19
     * @var Contact
20
     */
21
    protected Contact $contact;
22
23
    /**
24
     * @return Contact
25
     */
26
    public function getContact(): Contact
27
    {
28
        return $this->contact;
29
    }
30
31
    public function setContact(Contact $contact)
32
    {
33
        $this->contact = $contact;
34
        return $this;
35
    }
36
37
    /**
38
     * @ODM\PreRemove
39
     */
40
    public function preRemove()
41
    {
42
        $this->contact->setImage(null);
43
    }
44
}