Completed
Push — feature/fixing_cost ( ef981e )
by Laurent
01:53
created
Infrastructure/Common/Repository/AbstractDomainRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public function __construct(\DoliDB $db, $tableName)
24 24
     {
25 25
         $this->db = $db;
26
-        $this->tableName = strpos($tableName, MAIN_DB_PREFIX) === 0 ? $tableName : MAIN_DB_PREFIX.$tableName;
26
+        $this->tableName = strpos($tableName, MAIN_DB_PREFIX) === 0 ? $tableName : MAIN_DB_PREFIX . $tableName;
27 27
     }
28 28
 
29 29
     /**
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
      *
34 34
      * @throws \Exception
35 35
      */
36
-    protected function write(array $elements){
36
+    protected function write(array $elements) {
37 37
         $columns = join(',', array_keys($elements));
38
-        $values = join(',', array_map(function($value){
39
-                if(is_null($value)){
38
+        $values = join(',', array_map(function($value) {
39
+                if (is_null($value)) {
40 40
                     return null;
41 41
                 }
42 42
 
43
-                if(is_bool($value)){
44
-                    return (int)$value;
43
+                if (is_bool($value)) {
44
+                    return (int) $value;
45 45
                 }
46 46
 
47
-                return is_string($value) ? $this->db->escape($value) : $value ;
47
+                return is_string($value) ? $this->db->escape($value) : $value;
48 48
             }, array_values($elements)));
49 49
 
50 50
         $this->db->begin();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             $lasterror = $this->db->lasterror();
55 55
             dol_syslog(__METHOD__ . ' ' . $lasterror, LOG_ERR);
56 56
             $this->db->rollback();
57
-            throw new \Exception("Repository error - ".$lasterror);
57
+            throw new \Exception("Repository error - " . $lasterror);
58 58
         }
59 59
 
60 60
         $id = $this->db->last_insert_id($this->tableName);
Please login to merge, or discard this patch.
Damage/Query/Repository/GetDamagesForFlightQueryRepository.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     public function __invoke($flightId)
32 32
     {
33 33
         $sql = 'SELECT damage.amount, author.login as author_name';
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
         $damages = [];
39 39
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         if ($resql) {
42 42
             $num = $this->db->num_rows($resql);
43 43
             if ($num) {
44
-                for($i = 0; $i < $num ; $i++) {
44
+                for ($i = 0; $i < $num; $i++) {
45 45
                     $properties = $this->db->fetch_array($resql);
46 46
                     $damages[] = Damage::fromArray($properties);
47 47
                 }
Please login to merge, or discard this patch.
Infrastructure/Damage/Query/Repository/GetPilotDamagesQueryRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
     public function query($year)
31 31
     {
32 32
         $sql = 'SELECT SUM(damage.amount) as total_amount, damage.author_id as author';
33
-        $sql.=' FROM '.MAIN_DB_PREFIX.'bbc_flight_damages as damage';
34
-        $sql.=' INNER JOIN '.MAIN_DB_PREFIX.'bbc_vols as flight ON flight.rowid = damage.flight_id';
35
-        $sql.=' WHERE YEAR(flight.date) = '.$this->db->escape($year);
36
-        $sql.=' GROUP BY damage.author_id';
33
+        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bbc_flight_damages as damage';
34
+        $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'bbc_vols as flight ON flight.rowid = damage.flight_id';
35
+        $sql .= ' WHERE YEAR(flight.date) = ' . $this->db->escape($year);
36
+        $sql .= ' GROUP BY damage.author_id';
37 37
 
38 38
         $damages = [];
39 39
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         if ($resql) {
42 42
             $num = $this->db->num_rows($resql);
43 43
             if ($num) {
44
-                for($i = 0; $i < $num ; $i++) {
44
+                for ($i = 0; $i < $num; $i++) {
45 45
                     $properties = $this->db->fetch_array($resql);
46 46
                     $damages[] = TotalDamage::fromArray($properties);
47 47
                 }
Please login to merge, or discard this patch.
Form/Form.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function add(FormElementInterface $element)
89 89
     {
90
-        if(array_key_exists($element->getName(), $this->elements)){
90
+        if (array_key_exists($element->getName(), $this->elements)) {
91 91
             throw new \InvalidArgumentException('Element already exists');
92 92
         }
93 93
         $this->elements[$element->getName()] = $element;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function getErrorMessages()
143 143
     {
144
-        if(!$this->validator){
144
+        if (!$this->validator) {
145 145
             return [];
146 146
         }
147 147
 
Please login to merge, or discard this patch.
class/Common/ValueObject/Id.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      *
25 25
      * @return Id
26 26
      */
27
-    public static function create($id){
27
+    public static function create($id) {
28 28
         return new self($id);
29 29
     }
30 30
 
Please login to merge, or discard this patch.
class/Damage/FlightDamage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @return FlightDamage
48 48
      */
49
-    public static function damage(FlightId $flightId, DamageAmount $amount, AuthorId $authorId){
49
+    public static function damage(FlightId $flightId, DamageAmount $amount, AuthorId $authorId) {
50 50
         return new self($flightId, $amount, false, $authorId);
51 51
     }
52 52
 
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
     /**
62 62
      * @return FlightId
63 63
      */
64
-    public function getFlightId(){
64
+    public function getFlightId() {
65 65
         return $this->flight;
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return DamageAmount
70 70
      */
71
-    public function amount(){
71
+    public function amount() {
72 72
         return $this->amount;
73 73
     }
74 74
 
Please login to merge, or discard this patch.
class/card/TabCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      * @return array
54 54
      */
55 55
     public function toArray() {
56
-        return array_map(function(Tab $tab){
56
+        return array_map(function(Tab $tab) {
57 57
             return $tab->toArray();
58 58
         }, $this->tabs);
59 59
     }
Please login to merge, or discard this patch.
Application/Damage/ViewModel/Damage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
      *
33 33
      * @return Damage
34 34
      */
35
-    public static function fromArray(array $properties){
35
+    public static function fromArray(array $properties) {
36 36
         $author = $properties['author_name'];
37 37
         $amount = $properties['amount'];
38 38
 
Please login to merge, or discard this patch.
Application/Damage/Command/CreateDamageCommandHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
      */
56 56
     private function linkSupplierInvoice($flightId, $invoiceId)
57 57
     {
58
-        if($invoiceId <= 0){
58
+        if ($invoiceId <= 0) {
59 59
             return;
60 60
         }
61 61
 
Please login to merge, or discard this patch.