PilotService   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isPilot() 0 8 2
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
}