Passed
Push — master ( 727475...c2e18b )
by Igor
04:07
created

DetailLawyer::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

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