Completed
Push — feature/height_graph ( 5e5a0c...2ce1d7 )
by Laurent
02:11
created
Damage/Query/Repository/GetDamagesForFlightQueryRepository.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
     public function __invoke($flightId)
32 32
     {
33 33
         $sql = 'SELECT damage.author_id as author_id, damage.rowid as id, damage.amount, CONCAT(author.firstname, " " , author.lastname) as author_name, damage.billed as invoiced';
34
-        $sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage';
35
-        $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'user as author ON author.rowid = damage.author_id';
36
-        $sql.=' WHERE damage.flight_id = '.$this->db->escape($flightId);
34
+        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bbc_flight_damages as damage';
35
+        $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'user as author ON author.rowid = damage.author_id';
36
+        $sql .= ' WHERE damage.flight_id = ' . $this->db->escape($flightId);
37 37
 
38 38
         $resql = $this->db->query($sql);
39 39
         if ($resql) {
40 40
             $num = $this->db->num_rows($resql);
41 41
             if ($num) {
42
-                for($i = 0; $i < $num ; $i++) {
42
+                for ($i = 0; $i < $num; $i++) {
43 43
                     $properties = $this->db->fetch_array($resql);
44 44
                     yield Damage::fromArray($properties);
45 45
                 }
Please login to merge, or discard this patch.
Infrastructure/Damage/Query/Repository/GetDamageQueryRepository.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $this->db = $db;
23 23
     }
24 24
 
25
-    private function element($objectType, $rowid){
25
+    private function element($objectType, $rowid) {
26 26
         $element = null;
27 27
         $subelement = null;
28 28
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             $subelement = $regs[2];
34 34
         }
35 35
 
36
-        $classpath = $element.'/class';
36
+        $classpath = $element . '/class';
37 37
 
38 38
         if ($objectType == 'facture') {
39 39
             $classpath = 'compta/facture/class';
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             $classfile = 'subscription'; $classname = 'Subscription';
86 86
         }
87 87
 
88
-        dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
88
+        dol_include_once('/' . $classpath . '/' . $classfile . '.class.php');
89 89
         if (!class_exists($classname))
90 90
         {
91 91
             return null;
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
      *
105 105
      * @throws \Exception
106 106
      */
107
-    public function query($damageId){
107
+    public function query($damageId) {
108 108
 
109 109
         $sql = 'SELECT damage.author_id as  author_id, damage.rowid as id, damage.amount, CONCAT(author.firstname, " " , author.lastname) as author_name, damage.billed as invoiced, damage.flight_id as flight_id';
110
-        $sql.= ', element.rowid as element_id ,element.fk_target as element_fk_target, element.targettype as element_target_type';
111
-        $sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage';
112
-        $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'user as author ON author.rowid = damage.author_id';
113
-        $sql.=' LEFT JOIN '.MAIN_DB_PREFIX.'element_element as element ON (element.fk_source = damage.rowid AND element.sourcetype = "flightlog_damage")';
114
-        $sql.=' WHERE damage.rowid = '.$damageId;
110
+        $sql .= ', element.rowid as element_id ,element.fk_target as element_fk_target, element.targettype as element_target_type';
111
+        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bbc_flight_damages as damage';
112
+        $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'user as author ON author.rowid = damage.author_id';
113
+        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'element_element as element ON (element.fk_source = damage.rowid AND element.sourcetype = "flightlog_damage")';
114
+        $sql .= ' WHERE damage.rowid = ' . $damageId;
115 115
 
116 116
         $resql = $this->db->query($sql);
117 117
         if (!$resql) {
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 
126 126
         /** @var Damage $damage */
127 127
         $damage = null;
128
-        for($i = 0; $i < $num ; $i++) {
128
+        for ($i = 0; $i < $num; $i++) {
129 129
             $properties = $this->db->fetch_array($resql);
130
-            if(!$damage){
130
+            if (!$damage) {
131 131
                 $damage = Damage::fromArray($properties);
132 132
             }
133 133
 
134
-            if(!isset($properties['element_id'])){
134
+            if (!isset($properties['element_id'])) {
135 135
                 continue;
136 136
             }
137 137
 
Please login to merge, or discard this patch.
Application/Damage/ViewModel/Damage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@
 block discarded – undo
66 66
      *
67 67
      * @return Damage
68 68
      */
69
-    public static function fromArray(array $properties){
69
+    public static function fromArray(array $properties) {
70 70
         $authorId = $properties['author_id'];
71 71
         $author = $properties['author_name'];
72 72
         $amount = $properties['amount'];
73 73
         $id = $properties['id'];
74 74
         $flightId = isset($properties['flight_id']) ? $properties['flight_id'] : null;
75
-        $invoiced = (bool)$properties['invoiced'];
75
+        $invoiced = (bool) $properties['invoiced'];
76 76
 
77 77
         return new self($authorId, $author, $amount, $id, $invoiced, $flightId);
78 78
     }
Please login to merge, or discard this patch.
Flight/Query/Repository/GetBillableFlightPerMonthQueryRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,13 +64,13 @@
 block discarded – undo
64 64
 
65 65
         $stats = new BillableFlightByYearMonth();
66 66
 
67
-        for($i = 0; $i < $num ; $i++) {
67
+        for ($i = 0; $i < $num; $i++) {
68 68
             $properties = $this->db->fetch_array($resql);
69 69
             $stat = Statistic::fromArray($properties);
70 70
             $stats->add($stat);
71 71
         }
72 72
 
73
-        $stats->add(new Statistic(0,1,(new \DateTime())->format('Y')));
73
+        $stats->add(new Statistic(0, 1, (new \DateTime())->format('Y')));
74 74
 
75 75
         return $stats;
76 76
     }
Please login to merge, or discard this patch.
Application/Flight/ViewModel/BillableFlightByYearMonth.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function add(Statistic $stat)
18 18
     {
19
-        if(!isset($this->data[$stat->year()])){
19
+        if (!isset($this->data[$stat->year()])) {
20 20
             $this->data[$stat->year()] = [];
21
-            for($i = 1 ; $i <= 12 ; $i++){
21
+            for ($i = 1; $i <= 12; $i++) {
22 22
                 $this->data[$stat->year()][$i] = new Statistic(0, $stat->month(), $stat->year());
23 23
             }
24 24
         }
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
         $this->data[$stat->year()][$stat->month()] = $stat;
27 27
     }
28 28
 
29
-    public function data(){
29
+    public function data() {
30 30
         return $this->data;
31 31
     }
32 32
 
33
-    public function years(){
33
+    public function years() {
34 34
         return array_keys($this->data);
35 35
     }
36 36
 
Please login to merge, or discard this patch.
Application/Flight/ViewModel/Statistic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@
 block discarded – undo
44 44
         return $this->number;
45 45
     }
46 46
 
47
-    public function year(){
47
+    public function year() {
48 48
         return $this->year;
49 49
     }
50 50
 
51
-    public function month(){
51
+    public function month() {
52 52
         return $this->month;
53 53
     }
54 54
 
Please login to merge, or discard this patch.