PilotService::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 */
5
6
/**
7
 * PilotService class
8
 *
9
 * @author Laurent De Coninck <[email protected]>
10
 */
11
class PilotService
12
{
13
14
    /**
15
     * @var DoliDB
16
     */
17
    private $db;
18
19
    /**
20
     * PilotService constructor.
21
     *
22
     * @param DoliDB $db
23
     */
24
    public function __construct(DoliDB $db)
25
    {
26
        $this->db = $db;
27
    }
28
29
    /**
30
     *
31
     * @param int $userId
32
     *
33
     * @return bool
34
     */
35
    public function isPilot($userId)
36
    {
37
        $pilot = new User($this->db);
38
        $pilot->fetch($userId);
39
        $pilot->getrights("flightlog");
40
41
        return isset($pilot->rights->flightlog->vol->add) && $pilot->rights->flightlog->vol->add;
42
    }
43
}