Completed
Push — feature/degat ( f1f54e )
by Laurent
01:42
created
Application/Damage/Command/CreateDamageCommandHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     public function __invoke(CreateDamageCommand $command)
43 43
     {
44 44
         $damage = FlightDamage::waiting(new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId()), new DamageLabel($command->getLabel()));
45
-        if(null !== $command->getFlightId()){
45
+        if (null !== $command->getFlightId()) {
46 46
             $damage = FlightDamage::damage(FlightId::create($command->getFlightId()), new DamageLabel($command->getLabel()), new DamageAmount($command->getAmount()), AuthorId::create($command->getAuthorId()));
47 47
         }
48 48
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     private function linkSupplierInvoice($damageId, $invoiceId)
62 62
     {
63
-        if($invoiceId <= 0){
63
+        if ($invoiceId <= 0) {
64 64
             return;
65 65
         }
66 66
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
      * @param int $targetId
82 82
      * @param string $targetType
83 83
      */
84
-    private function insertLinks($damageId, $targetId, $targetType){
85
-        $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
84
+    private function insertLinks($damageId, $targetId, $targetType) {
85
+        $sql = "INSERT INTO " . MAIN_DB_PREFIX . "element_element (";
86 86
         $sql .= "fk_source";
87 87
         $sql .= ", sourcetype";
88 88
         $sql .= ", fk_target";
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
         $sql .= ") VALUES (";
91 91
         $sql .= $damageId;
92 92
         $sql .= ", 'flightlog_damage'";
93
-        $sql .= ", ".$targetId;
94
-        $sql .= ", '".$targetType."'";
93
+        $sql .= ", " . $targetId;
94
+        $sql .= ", '" . $targetType . "'";
95 95
         $sql .= ")";
96 96
 
97 97
         if ($this->db->query($sql))
Please login to merge, or discard this patch.
class/Damage/ValueObject/DamageLabel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         $this->label = $label;
16 16
     }
17 17
 
18
-    public function value(){
18
+    public function value() {
19 19
         return $this->label;
20 20
     }
21 21
 
Please login to merge, or discard this patch.
class/flight/Pilot.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
         return new Pilot($this->name, $this->id, $types);
107 107
     }
108 108
 
109
-    public function addDamage(FlightDamageCount $damage){
109
+    public function addDamage(FlightDamageCount $damage) {
110 110
         $this->damages[] = $damage;
111 111
     }
112 112
 
113
-    public function addInvoicedDamage(FlightInvoicedDamageCount $damage){
113
+    public function addInvoicedDamage(FlightInvoicedDamageCount $damage) {
114 114
         $this->damages[] = $damage;
115 115
     }
116 116
 
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
         return $flightsCost;
162 162
     }
163 163
 
164
-    public function totalDamageCost(){
164
+    public function totalDamageCost() {
165 165
         $flightCost = FlightCost::zero();
166 166
 
167
-        foreach($this->damages as $damage){
167
+        foreach ($this->damages as $damage) {
168 168
             $flightCost = $flightCost->addCost($damage->getCost());
169 169
         }
170 170
 
171 171
         return $flightCost;
172 172
     }
173 173
 
174
-    public function damageCost(){
174
+    public function damageCost() {
175 175
         $flightCost = FlightCost::zero();
176 176
 
177
-        foreach($this->damages as $damage){
178
-            if(!$damage instanceof FlightDamageCount){
177
+        foreach ($this->damages as $damage) {
178
+            if (!$damage instanceof FlightDamageCount) {
179 179
                 continue;
180 180
             }
181 181
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
         return $flightCost;
186 186
     }
187 187
 
188
-    public function invoicedDamageCost(){
188
+    public function invoicedDamageCost() {
189 189
         $flightCost = FlightCost::zero();
190 190
 
191
-        foreach($this->damages as $damage){
192
-            if(!$damage instanceof FlightInvoicedDamageCount){
191
+        foreach ($this->damages as $damage) {
192
+            if (!$damage instanceof FlightInvoicedDamageCount) {
193 193
                 continue;
194 194
             }
195 195
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         return $flightCost;
200 200
     }
201 201
 
202
-    public function damages(){
202
+    public function damages() {
203 203
         return $this->damages;
204 204
     }
205 205
 
Please login to merge, or discard this patch.
query/BillableFlightQueryHandler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                     $pilots[$obj->pilot] = $pilots[$obj->pilot]->addCount(
72 72
                         new FlightTypeCount(
73 73
                             $obj->type,
74
-                            (int)$obj->nbr,
74
+                            (int) $obj->nbr,
75 75
                             $this->getFactorByType($obj->type)
76 76
                         )
77 77
                     );
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                         $pilots[$obj->rowid] = $pilots[$obj->rowid]->addCount(
107 107
                             new FlightTypeCount(
108 108
                                 'orga',
109
-                                (int)$obj->total,
109
+                                (int) $obj->total,
110 110
                                 $this->getFactorByType('orga')
111 111
                             )
112 112
                         );
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                         $pilots[$obj->rowid] = $pilots[$obj->rowid]->addCount(
137 137
                             new FlightTypeCount(
138 138
                                 'orga_T6',
139
-                                (int)$obj->total,
139
+                                (int) $obj->total,
140 140
                                 $this->getFactorByType('orga_T6')
141 141
                             )
142 142
                         );
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
         //Total damages
150 150
         $damages = $this->pilotDamageQueryRepository->query($query->getFiscalYear());
151
-        foreach($damages as $currentDamage){
151
+        foreach ($damages as $currentDamage) {
152 152
 
153 153
             //Pilot doesn't exist
154 154
             if (!isset($pilots[$currentDamage->getAuthorId()])) {
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 
158 158
             // Add all damage
159 159
             $pilots[$currentDamage->getAuthorId()]->addDamage(
160
-                new FlightDamageCount('',  $currentDamage->getAmount())
160
+                new FlightDamageCount('', $currentDamage->getAmount())
161 161
             );
162 162
 
163 163
             // The damage is already invoiced. So not take into account.
164
-            if($currentDamage->isInvoiced()){
164
+            if ($currentDamage->isInvoiced()) {
165 165
                 $pilots[$currentDamage->getAuthorId()]->addInvoicedDamage(
166
-                    new FlightInvoicedDamageCount('',  $currentDamage->getAmount())
166
+                    new FlightInvoicedDamageCount('', $currentDamage->getAmount())
167 167
                 );
168 168
             }
169 169
         }
Please login to merge, or discard this patch.