SapeurPompierSdisProfile::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 4
crap 1
1
<?php
2
3
namespace SDIS62\Core\User\Entity\Profile\Sdis;
4
5
use SDIS62\Core\User\Entity\User;
6
use SDIS62\Core\User\Entity\Profile\SdisProfile;
7
8
class SapeurPompierSdisProfile extends SdisProfile
9
{
10
    /**
11
     * Type du profil
12
     *
13
     * @var string
14
     */
15
    protected $type = 'sapeur_pompier';
16
17
    /**
18
     * Pro ou volontaire ?
19
     *
20
     * @var bool
21
     */
22
    protected $is_pro;
23
24
    /*
25
    * Constructeur
26
    *
27
    * @param SDIS62\Core\User\Entity\User $user
28
    * @param Sstring $grade
29
    * @param string $poste
30
    * @param bool $pro Optionnel
31
    */
32 45
    public function __construct(User $user, $grade, $poste, $pro = false)
33
    {
34 45
        $this->is_pro = $pro;
35
36 45
        parent::__construct($user, $grade, $poste);
37 45
    }
38
39
    /**
40
     * Get the value of Pro ou volontaire ?
41
     *
42
     * @return bool
43
     */
44 6
    public function isPro()
45
    {
46 6
        return $this->is_pro == true;
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
47
    }
48
49
    /**
50
     * Set the value of Pro ou volontaire ?
51
     *
52
     * @param bool is_pro
53
     *
54
     * @return self
55
     */
56 6
    public function setPro($value = true)
57
    {
58 6
        $this->is_pro = $value == true;
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
59
60 6
        return $this;
61
    }
62
}
63