Completed
Pull Request — master (#95)
by
unknown
01:26
created

Section   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 0
loc 77
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A getCode() 0 4 1
A setCode() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getSectionTranslation() 0 4 1
A createTranslation() 0 4 1
1
<?php
2
3
/**
4
 * This file was created by the developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusCmsPlugin\Entity;
14
15
use Sylius\Component\Resource\Model\TranslatableTrait;
16
use Sylius\Component\Resource\Model\TranslationInterface;
17
18
/**
19
 * @author Patryk Drapik <[email protected]>
20
 */
21
class Section implements SectionInterface
22
{
23
    use TranslatableTrait {
24
        __construct as private initializeTranslationsCollection;
25
    }
26
27
    /**
28
     * @var null|int
29
     */
30
    protected $id;
31
32
    /**
33
     * @var null|string
34
     */
35
    protected $code;
36
37
    public function __construct()
38
    {
39
        $this->initializeTranslationsCollection();
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getId(): ?int
46
    {
47
        return $this->id;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getCode(): ?string
54
    {
55
        return $this->code;
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function setCode(?string $code): void
62
    {
63
        $this->code = $code;
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function getName(): ?string
70
    {
71
        return $this->getSectionTranslation()->getName();
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function setName(?string $name): void
78
    {
79
        $this->getSectionTranslation()->setName($name);
80
    }
81
82
    /**
83
     * @return TranslationInterface|SectionTranslationInterface
84
     */
85
    protected function getSectionTranslation(): TranslationInterface
86
    {
87
        return $this->getTranslation();
88
    }
89
90
    /**
91
     * {@inheritdoc}
92
     */
93
    protected function createTranslation(): TranslationInterface
94
    {
95
        return new SectionTranslation();
96
    }
97
}