@@ -526,7 +526,7 @@ |
||
526 | 526 | |
527 | 527 | public function attributeRadioLicenceDate(RadioLicenceDate $value) |
528 | 528 | { |
529 | - $this->radioLicenceDate = $value; |
|
529 | + $this->radioLicenceDate = $value; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | public function attributeLastTrainingFirstHelpDate(LastTrainingDate $value) |
@@ -23,7 +23,7 @@ |
||
23 | 23 | return self::no(); |
24 | 24 | } |
25 | 25 | |
26 | - if (is_numeric($value) || is_int($value) || (int)$value == $value) { |
|
26 | + if (is_numeric($value) || is_int($value) || (int) $value == $value) { |
|
27 | 27 | return new self($value == 1); |
28 | 28 | } |
29 | 29 |
@@ -172,13 +172,13 @@ |
||
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | |
175 | - if($match == ".." || $match == "." || substr($match, 0,1) === '.'){ |
|
175 | + if ($match == ".." || $match == "." || substr($match, 0, 1) === '.') { |
|
176 | 176 | continue; |
177 | 177 | } |
178 | 178 | |
179 | 179 | $element = $root . DIRECTORY_SEPARATOR . $match; |
180 | 180 | |
181 | - if(substr_count($element, '/', 3) >= 1){ |
|
181 | + if (substr_count($element, '/', 3) >= 1) { |
|
182 | 182 | scan($element); |
183 | 183 | } |
184 | 184 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | parent::__construct($name, FormElementInterface::TYPE_CHECKBOX, $options); |
17 | 17 | } |
18 | 18 | |
19 | - public function checkedValue(){ |
|
19 | + public function checkedValue() { |
|
20 | 20 | return 1; |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
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,7 +33,7 @@ discard block |
||
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 | 38 | $values = join(',', array_map([$this, 'escape'], array_values($elements))); |
39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $lasterror = $this->db->lasterror(); |
45 | 45 | dol_syslog(__METHOD__ . ' ' . $lasterror, LOG_ERR); |
46 | 46 | $this->db->rollback(); |
47 | - throw new \Exception("Repository error - ".$lasterror); |
|
47 | + throw new \Exception("Repository error - " . $lasterror); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $id = $this->db->last_insert_id($this->tableName); |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return int|string|null |
59 | 59 | */ |
60 | - private function escape($value){ |
|
61 | - if(is_null($value)){ |
|
60 | + private function escape($value) { |
|
61 | + if (is_null($value)) { |
|
62 | 62 | return 'NULL'; |
63 | 63 | } |
64 | 64 | |
65 | - if(is_bool($value)){ |
|
66 | - return (int)$value; |
|
65 | + if (is_bool($value)) { |
|
66 | + return (int) $value; |
|
67 | 67 | } |
68 | 68 | |
69 | - return is_string($value) ? "'".$this->db->escape($value)."'" : $value ; |
|
69 | + return is_string($value) ? "'" . $this->db->escape($value) . "'" : $value; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -79,18 +79,18 @@ discard block |
||
79 | 79 | { |
80 | 80 | $sqlModifications = []; |
81 | 81 | |
82 | - foreach($elements as $field => $value){ |
|
82 | + foreach ($elements as $field => $value) { |
|
83 | 83 | $sqlModifications[] = sprintf('%s=%s', $field, $this->escape($value)); |
84 | 84 | } |
85 | 85 | |
86 | 86 | $this->db->begin(); |
87 | - $resql = $this->db->query(sprintf('UPDATE %s SET %s WHERE '.$idCol.' = %s ', $this->tableName, join(',',$sqlModifications), $id)); |
|
87 | + $resql = $this->db->query(sprintf('UPDATE %s SET %s WHERE ' . $idCol . ' = %s ', $this->tableName, join(',', $sqlModifications), $id)); |
|
88 | 88 | |
89 | 89 | if (!$resql) { |
90 | 90 | $lasterror = $this->db->lasterror(); |
91 | 91 | dol_syslog(__METHOD__ . ' ' . $lasterror, LOG_ERR); |
92 | 92 | $this->db->rollback(); |
93 | - throw new \Exception("Repository error - ".$lasterror); |
|
93 | + throw new \Exception("Repository error - " . $lasterror); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $this->db->commit(); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return array|null |
106 | 106 | */ |
107 | - protected function get($id, $idCol = 'rowid'){ |
|
108 | - $sql = sprintf('SELECT * FROM %s WHERE '.$idCol.' = %s', $this->tableName, $id ); |
|
107 | + protected function get($id, $idCol = 'rowid') { |
|
108 | + $sql = sprintf('SELECT * FROM %s WHERE ' . $idCol . ' = %s', $this->tableName, $id); |
|
109 | 109 | |
110 | 110 | $resql = $this->db->query($sql); |
111 | 111 | if (!$resql) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return null; |
118 | 118 | } |
119 | 119 | |
120 | - for($i = 0; $i < $num ; $i++) { |
|
120 | + for ($i = 0; $i < $num; $i++) { |
|
121 | 121 | return $this->db->fetch_array($resql); |
122 | 122 | } |
123 | 123 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | $pilots = []; |
47 | - for($i = 0; $i < $num ; $i++) { |
|
47 | + for ($i = 0; $i < $num; $i++) { |
|
48 | 48 | $pilots[] = Pilot::fromArray($this->db->fetch_array($resql)); |
49 | 49 | } |
50 | 50 |