FlightTypeSelect   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 1
A buildOptions() 0 6 2
1
<?php
2
/**
3
 *
4
 */
5
6
namespace flightlog\form;
7
8
/**
9
 * FlightTypeSelect class
10
 *
11
 * @author Laurent De Coninck <[email protected]>
12
 */
13
class FlightTypeSelect extends Select
14
{
15
    /**
16
     * @var \Bbctypes
17
     */
18
    private $flightType;
19
20
    /**
21
     * @inheritDoc
22
     */
23
    public function __construct($name, array $options = [], \DoliDB $db)
24
    {
25
        parent::__construct($name, $options);
26
        $this->flightType = new \Bbctypes($db);
27
        $this->flightType->fetchAll(
28
            'ASC',
29
            'numero',
30
            0,
31
            0,
32
            [
33
                "active" => 1
34
            ]
35
        );
36
37
        $this->buildOptions();
38
39
    }
40
41
    /**
42
     * Build the options of the select
43
     */
44
    private function buildOptions()
45
    {
46
        foreach ($this->flightType->getLines() as $currentFlightType) {
47
            $this->addValueOption($currentFlightType->getId(), $currentFlightType->getLabel());
48
        }
49
    }
50
51
52
}