Passed
Pull Request — master (#1)
by Igor
02:41
created

DetailLawyer::loadFromLawyer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SomeWork\Minjust\Entity;
4
5
class DetailLawyer extends Lawyer
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $chamberOfLaw;
11
12
    /**
13
     * @var LawFormation|null
14
     */
15
    protected $lawFormation;
16
17
    public static function init(Lawyer $lawyer): DetailLawyer
18
    {
19
        return (new self())
20
            ->loadFromLawyer($lawyer);
21
    }
22
23
    public function loadFromLawyer(Lawyer $lawyer): self
24
    {
25
        return $this
26
            ->setRegisterNumber($lawyer->getRegisterNumber())
27
            ->setFullName($lawyer->getFullName())
28
            ->setUrl($lawyer->getUrl())
29
            ->setTerritorialSubject($lawyer->getTerritorialSubject())
30
            ->setCertificateNumber($lawyer->getCertificateNumber())
31
            ->setStatus($lawyer->getStatus());
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getChamberOfLaw(): string
38
    {
39
        return $this->chamberOfLaw ?: '';
40
    }
41
42
    /**
43
     * @param string $chamberOfLaw
44
     *
45
     * @return DetailLawyer
46
     */
47
    public function setChamberOfLaw(string $chamberOfLaw): DetailLawyer
48
    {
49
        $this->chamberOfLaw = $chamberOfLaw;
50
51
        return $this;
52
    }
53
54
    /**
55
     * @return LawFormation|null
56
     */
57
    public function getLawFormation(): ?LawFormation
58
    {
59
        return $this->lawFormation;
60
    }
61
62
    /**
63
     * @param LawFormation|null $lawFormation
64
     *
65
     * @return DetailLawyer
66
     */
67
    public function setLawFormation(?LawFormation $lawFormation): DetailLawyer
68
    {
69
        $this->lawFormation = $lawFormation;
70
71
        return $this;
72
    }
73
}
74