Passed
Branchfeature/useWidgetsNamespaces (eb4650)
by Robin
02:57
created
programs/init.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 use Capwelton\LibOrm\MySql\ORMMySqlBackend;
26 26
 
27 27
 
28
-require_once dirname(__FILE__). '/functions.php';
28
+require_once dirname(__FILE__).'/functions.php';
29 29
 
30 30
 
31 31
 function LibApp_upgrade($sVersionBase, $sVersionIni)
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
     
82 82
     $babBody = bab_getBody();
83 83
     $addon = bab_getAddonInfosInstance('libapp');
84
-    $babBody->addStyleSheet($addon->getStylePath() . '/styles.css');
85
-    $babBody->addJavascriptFile($addon->getTemplatePath() . 'libapp.js');
84
+    $babBody->addStyleSheet($addon->getStylePath().'/styles.css');
85
+    $babBody->addJavascriptFile($addon->getTemplatePath().'libapp.js');
86 86
     
87 87
     $App = app_App();
88
-    if($App->isSSEEnabled()){
89
-        $babBody->addJavascriptFile($addon->getTemplatePath() . 'notification.js');
90
-        if(bab_isUserLogged()){
88
+    if ($App->isSSEEnabled()) {
89
+        $babBody->addJavascriptFile($addon->getTemplatePath().'notification.js');
90
+        if (bab_isUserLogged()) {
91 91
             $babBody->babecho('<script>window.libapp={"sseServerUrl": "'.$App->Controller()->SSE()->server()->url().'"}</script>');
92 92
             $babBody->addJavascriptFile($addon->getTemplatePath().'sse.js');
93 93
         }
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
         $addonPhpPath = $addon->getPhpPath();
114 114
         
115 115
         require_once $GLOBALS['babInstallPath'].'utilit/functionalityincl.php';
116
-        require_once dirname(__FILE__) . '/portletbackend.class.php';
116
+        require_once dirname(__FILE__).'/portletbackend.class.php';
117 117
         $functionalities = new bab_functionalities();
118
-        $functionalities->registerClass('Func_PortletBackend_App', $addonPhpPath . 'portletbackend.class.php');
118
+        $functionalities->registerClass('Func_PortletBackend_App', $addonPhpPath.'portletbackend.class.php');
119 119
     }
120 120
 }
121 121
\ No newline at end of file
Please login to merge, or discard this patch.
programs/Set/AppTraceableRecordSet.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function logSave(AppTraceableRecord $record, $noTrace)
135 135
     {
136
-        if(! $this->isLoggable()){
136
+        if (!$this->isLoggable()) {
137 137
             return;
138 138
         }
139 139
         $App = $this->App();
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
      */
157 157
     protected function logDelete(ORMCriteria $criteria, $noTrace)
158 158
     {
159
-        if(! $this->isLoggable()){
159
+        if (!$this->isLoggable()) {
160 160
             return;
161 161
         }
162 162
         $App = $this->App();
163 163
         $userId = bab_getUserId();
164 164
         $logSet = $App->LogSet();
165 165
         $deletedRecords = $this->select($criteria);
166
-        foreach ($deletedRecords as $record){
166
+        foreach ($deletedRecords as $record) {
167 167
             $log = $logSet->newRecord();
168 168
             $log->noTrace = $noTrace;
169 169
             $log->objectClass = get_class($record);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function select(ORMCriteria $criteria = null, $includeDeleted = false)
191 191
     {
192
-        if($includeDeleted){
192
+        if ($includeDeleted) {
193 193
             $this->setDefaultCriteria(null);
194 194
         }
195 195
         return parent::select($criteria);
@@ -232,25 +232,25 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function delete(ORMCriteria $criteria = null, $deletedStatus = AppTraceableRecord::DELETED_STATUS_DELETED)
234 234
     {
235
-        $definitive = ($deletedStatus === true) || ! $this->isTraceable();
235
+        $definitive = ($deletedStatus === true) || !$this->isTraceable();
236 236
         $this->logDelete($criteria, $definitive);
237
-        if($definitive){
237
+        if ($definitive) {
238 238
             return parent::delete($criteria);
239 239
         }
240 240
         
241
-        require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php';
241
+        require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php';
242 242
         $now = \BAB_DateTime::now()->getIsoDateTime();
243 243
         
244 244
         $records = $this->select($criteria);
245 245
         
246
-        foreach ($records as $record){
246
+        foreach ($records as $record) {
247 247
             /* @var $record AppTraceableRecord */
248 248
             // Could be optimized at ORM level
249 249
             $record->deleted = $deletedStatus;
250 250
             $record->deletedOn = $now;
251 251
             $record->deletedBy = bab_getUserId();
252 252
             
253
-            if(! parent::save($record)){
253
+            if (!parent::save($record)) {
254 254
                 return false;
255 255
             }
256 256
         }
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
      */
269 269
     public function save(ORMRecord $record, $noTrace = false)
270 270
     {
271
-        $noTrace = $noTrace || ! $this->isTraceable();
271
+        $noTrace = $noTrace || !$this->isTraceable();
272 272
         $this->logSave($record, $noTrace);
273
-        if($noTrace){
273
+        if ($noTrace) {
274 274
             return parent::save($record);
275 275
         }
276 276
         
277
-        require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php';
277
+        require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php';
278 278
         
279 279
         $now = \BAB_DateTime::now()->getIsoDateTime();
280 280
         
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         $set = $record->getParentSet();
283 283
         $primaryKey = $set->getPrimaryKey();
284 284
         
285
-        if(empty($record->{$primaryKey})){
285
+        if (empty($record->{$primaryKey})) {
286 286
             $record->initValue('createdBy', bab_getUserId());
287 287
             $record->initValue('createdOn', $now);
288 288
             $record->initValue('uuid', $this->uuid());
@@ -313,21 +313,21 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function getRecordByUuid($uuid)
315 315
     {
316
-        if('' === (string) $uuid){
316
+        if ('' === (string) $uuid) {
317 317
             return null;
318 318
         }
319 319
         
320 320
         $record = $this->get($this->uuid->is($uuid));
321 321
         
322
-        if(! isset($record)){
322
+        if (!isset($record)) {
323 323
             return null;
324 324
         }
325 325
         
326
-        if(! ($record instanceof AppTraceableRecord)){
326
+        if (!($record instanceof AppTraceableRecord)) {
327 327
             return null;
328 328
         }
329 329
         
330
-        if($record->deleted){
330
+        if ($record->deleted) {
331 331
             return null;
332 332
         }
333 333
         
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      */
344 344
     public function isOwn($userId = null)
345 345
     {
346
-        if(! isset($userId)){
346
+        if (!isset($userId)) {
347 347
             $userId = bab_getUserId();
348 348
         }
349 349
         return $this->createdBy->is($userId);
Please login to merge, or discard this patch.
programs/Set/AppRecord.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $value = $this->oParentSet->getBackend()->getRecordValue($this, $sFieldName);
60 60
         $field = $this->oParentSet->$sFieldName;
61
-        if(! is_null($value) && $field instanceof ORMFkField){
61
+        if (!is_null($value) && $field instanceof ORMFkField) {
62 62
             
63 63
             $sClassName = $field->getForeignSetName();
64 64
             
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function App()
95 95
     {
96
-        if(! isset($this->app)){
96
+        if (!isset($this->app)) {
97 97
             // If the app object was not specified (through the setApp() method),
98 98
             // we set it as parent set's App.
99 99
             $this->setApp($this->getParentSet()
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $App = $this->App();
115 115
         $rClass = new \ReflectionClass(get_class($this));
116 116
         $component = $App->getComponentByName($rClass->getShortName());
117
-        if(isset($component)){
117
+        if (isset($component)) {
118 118
             return $component->getRecordClassName();
119 119
             // list(, $classname) = explode('_', $component->getRecordClassName());
120 120
             // return $classname;
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function getRef()
132 132
     {
133
-        if(! isset($this->id)){
133
+        if (!isset($this->id)) {
134 134
             throw new AppException('Trying to get the reference string of a record without an id.');
135 135
         }
136 136
         $classname = $this->getClassName();
137
-        return $classname . ':' . $this->id;
137
+        return $classname.':'.$this->id;
138 138
     }
139 139
     
140 140
     /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     {
162 162
         $App = $this->App();
163 163
         
164
-        if(! isset($deletedStatus)){
164
+        if (!isset($deletedStatus)) {
165 165
             $deletedStatus = AppTraceableRecord::DELETED_STATUS_DELETED;
166 166
         }
167 167
         
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         // referenced elements.
174 174
         $manyRelations = $set->getHasManyRelations();
175 175
         
176
-        foreach ($manyRelations as $manyRelation){
176
+        foreach ($manyRelations as $manyRelation) {
177 177
             /* @var $manyRelation ORMManyRelation */
178 178
             
179 179
             $foreignSetClassName = $manyRelation->getForeignSetClassName();
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                     
188 188
                     $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
189 189
                     
190
-                    foreach ($foreignRecords as $foreignRecord){
190
+                    foreach ($foreignRecords as $foreignRecord) {
191 191
                         $foreignRecord->$foreignSetFieldName = 0;
192 192
                         $foreignRecord->save();
193 193
                     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                     
199 199
                     $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
200 200
                     
201
-                    foreach ($foreignRecords as $foreignRecord){
201
+                    foreach ($foreignRecords as $foreignRecord) {
202 202
                         $foreignRecord->delete();
203 203
                     }
204 204
                     
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         // referenced elements.
245 245
         $manyRelations = $set->getHasManyRelations();
246 246
         
247
-        foreach ($manyRelations as $manyRelation){
247
+        foreach ($manyRelations as $manyRelation) {
248 248
             /* @var $manyRelation ORMManyRelation */
249 249
             
250 250
             $foreignSetClassName = $manyRelation->getForeignSetClassName();
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             // $foreignSet = new $foreignSetClassName($App);
255 255
             $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
256 256
             
257
-            foreach ($foreignRecords as $foreignRecord){
257
+            foreach ($foreignRecords as $foreignRecord) {
258 258
                 $foreignRecord->$foreignSetFieldName = $id;
259 259
                 $foreignRecord->save();
260 260
             }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $links = $linkSet->select($linkSet->sourceClass->is($recordClassName)
268 268
             ->_AND_($linkSet->sourceId->is($recordId)));
269 269
         
270
-        foreach ($links as $link){
270
+        foreach ($links as $link) {
271 271
             $link->sourceId = $id;
272 272
             $link->save();
273 273
         }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $links = $linkSet->select($linkSet->targetClass->is($recordClassName)
276 276
             ->_AND_($linkSet->targetId->is($recordId)));
277 277
         
278
-        foreach ($links as $link){
278
+        foreach ($links as $link) {
279 279
             $link->targetId = $id;
280 280
             $link->save();
281 281
         }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         
301 301
         $relatedRecords = array();
302 302
         
303
-        foreach ($manyRelations as $manyRelation){
303
+        foreach ($manyRelations as $manyRelation) {
304 304
             /* @var $manyRelation ORMManyRelation */
305 305
             
306 306
             $foreignSetClassName = $manyRelation->getForeignSetClassName();
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             // $foreignSet = new $foreignSetClassName($App);
312 312
             $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
313 313
             
314
-            if($foreignRecords->count() > 0){
314
+            if ($foreignRecords->count() > 0) {
315 315
                 $relatedRecords[$foreignSetClassName] = $foreignRecords;
316 316
             }
317 317
         }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     {
329 329
         $path = $this->App()->uploadPath();
330 330
         
331
-        if(null === $path){
331
+        if (null === $path) {
332 332
             throw new \Exception('Missing upload path information');
333 333
             return null;
334 334
         }
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
             ->_AND_($linkSet->sourceId->is($source->id))
352 352
             ->_AND_($linkSet->targetClass->is($this->getClassName()))
353 353
             ->_AND_($linkSet->targetId->is($this->id));
354
-        if(isset($linkType)){
355
-            if(is_array($linkType)){
354
+        if (isset($linkType)) {
355
+            if (is_array($linkType)) {
356 356
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
357 357
             }
358
-            else{
358
+            else {
359 359
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
360 360
             }
361 361
         }
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
         
380 380
         $criteria = $linkSet->all($linkSet->targetClass->is($target->getClassName()), $linkSet->targetId->is($target->id), $linkSet->sourceClass->is($this->getClassName()), $linkSet->sourceId->is($this->id));
381 381
         
382
-        if(isset($linkType)){
383
-            if(is_array($linkType)){
382
+        if (isset($linkType)) {
383
+            if (is_array($linkType)) {
384 384
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
385 385
             }
386
-            else{
386
+            else {
387 387
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
388 388
             }
389 389
         }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      */
446 446
     protected function importProperty($name, $value)
447 447
     {
448
-        if(((string) $this->$name) !== ((string) $value)){
448
+        if (((string) $this->$name) !== ((string) $value)) {
449 449
             $this->$name = $value;
450 450
             return 1;
451 451
         }
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
      */
466 466
     protected function importDate($name, $value)
467 467
     {
468
-        if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)){
468
+        if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) {
469 469
             return $this->importProperty($name, $value);
470 470
         }
471 471
         
472 472
         // try in DD/MM/YYYY format
473 473
         
474
-        if(preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)){
474
+        if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)) {
475 475
             
476 476
             $value = sprintf('%04d-%02d-%02d', (int) $matches['year'], (int) $matches['month'], (int) $matches['day']);
477 477
             
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
         $customContainers->groupBy($customContainerSet->view);
492 492
         
493 493
         $views = array();
494
-        foreach ($customContainers as $customContainer){
494
+        foreach ($customContainers as $customContainer) {
495 495
             $views[] = $customContainer->view;
496 496
         }
497 497
         
498
-        if(empty($views)){
498
+        if (empty($views)) {
499 499
             $views[] = '';
500 500
         }
501 501
         
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
      */
580 580
     public function requireReadable($message = null)
581 581
     {
582
-        if(! $this->isReadable()){
582
+        if (!$this->isReadable()) {
583 583
             $App = $this->App();
584
-            if(! isset($message)){
584
+            if (!isset($message)) {
585 585
                 $message = $App->translate('Access denied');
586 586
             }
587 587
             throw new AppAccessException($message);
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
      */
598 598
     public function requireUpdatable($message = null)
599 599
     {
600
-        if(! $this->isUpdatable()){
600
+        if (!$this->isUpdatable()) {
601 601
             $App = $this->App();
602
-            if(! isset($message)){
602
+            if (!isset($message)) {
603 603
                 $message = $App->translate('Access denied');
604 604
             }
605 605
             throw new AppAccessException($message);
@@ -615,9 +615,9 @@  discard block
 block discarded – undo
615 615
      */
616 616
     public function requireDeletable($message = null)
617 617
     {
618
-        if(! $this->isDeletable()){
618
+        if (!$this->isDeletable()) {
619 619
             $App = $this->App();
620
-            if(! isset($message)){
620
+            if (!isset($message)) {
621 621
                 $message = $App->translate('Access denied');
622 622
             }
623 623
             throw new AppAccessException($message);
Please login to merge, or discard this patch.
programs/Set/AppCustomField.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 break;
69 69
             
70 70
             default:
71
-                $function = 'Capwelton\LibOrm\ORM_' . $this->fieldtype . 'Field';
71
+                $function = 'Capwelton\LibOrm\ORM_'.$this->fieldtype.'Field';
72 72
                 $field = $function($this->fieldname);
73 73
                 break;
74 74
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $labelledItem = $W->LabelledWidget($this->name, $widget, null);
154 154
         $labelledItem->setName($this->fieldname);
155 155
         
156
-        if(! empty($this->description)){
156
+        if (!empty($this->description)) {
157 157
             $labelledItem->setDescription($this->description);
158 158
         }
159 159
         
Please login to merge, or discard this patch.
programs/Set/AppRecordSet.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
      */
103 103
     protected function trimSetName($setName)
104 104
     {
105
-        if(strpos($setName, '_') === false){
105
+        if (strpos($setName, '_') === false) {
106 106
             return $setName;
107 107
         }
108 108
         $pos = strrpos($setName, '\\');
109
-        if($pos === false){
109
+        if ($pos === false) {
110 110
             return explode('_', $setName)[1];
111 111
         }
112 112
         return substr($setName, $pos + 1);
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
     public function join($fkFieldName)
122 122
     {
123 123
         $fkField = $this->getField($fkFieldName);
124
-        if(! ($fkField instanceof ORMFkField)){
124
+        if (!($fkField instanceof ORMFkField)) {
125 125
             return $this;
126 126
         }
127 127
         $setName = $fkField->getForeignSetName();
128 128
         
129
-        if(! $setName || 'Set' === $setName){
130
-            throw new \Exception('The set name is missing on foreign key field ' . $fkFieldName);
129
+        if (!$setName || 'Set' === $setName) {
130
+            throw new \Exception('The set name is missing on foreign key field '.$fkFieldName);
131 131
         }
132 132
         
133 133
         $appSetName = $this->trimSetName($setName);
@@ -165,22 +165,22 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $App = $this->App();
167 167
         
168
-        if(null === $this->customFields){
168
+        if (null === $this->customFields) {
169 169
             $this->customFields = array();
170 170
             
171
-            if(isset($App->CustomField)){
171
+            if (isset($App->CustomField)) {
172 172
                 $customFieldSet = $App->CustomFieldSet();
173 173
                 $object = mb_substr(get_class($this), mb_strlen($App->classPrefix), - mb_strlen('Set'));
174
-                try{
174
+                try {
175 175
                     $customFields = $customFieldSet->select($customFieldSet->object->is($object));
176 176
                     
177
-                    foreach ($customFields as $customfield){
177
+                    foreach ($customFields as $customfield) {
178 178
                         $this->customFields[] = $customfield;
179 179
                         
180 180
                         /*@var $customfield AppCustomField */
181 181
                     }
182 182
                 }
183
-                catch (ORMBackEndSelectException $e){
183
+                catch (ORMBackEndSelectException $e) {
184 184
                     // table does not exist, this error is thrown by the install program while creating the sets
185 185
                 }
186 186
             }
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
     public function addCustomFields()
211 211
     {
212 212
         $customFields = $this->selectCustomFields();
213
-        foreach ($customFields as $customField){
213
+        foreach ($customFields as $customField) {
214 214
             /*@var $customField AppCustomField */
215 215
             $description = $customField->name;
216 216
             $ormField = $customField->getORMField()->setDescription($description);
217
-            if($ormField instanceof ORMFkField){
217
+            if ($ormField instanceof ORMFkField) {
218 218
                 $this->hasOne($customField->fieldname, $ormField->getForeignSetName())
219 219
                     ->setDescription($description);
220 220
             }
221
-            else{
221
+            else {
222 222
                 $this->addFields($ormField);
223 223
             }
224 224
         }
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
     public function request($mixedParam = null, $sPropertyName = null)
248 248
     {
249 249
         $record = $this->get($mixedParam, $sPropertyName);
250
-        if(! isset($record)){
250
+        if (!isset($record)) {
251 251
             // This will remove the default criteria for TraceableRecords and
252 252
             // fetch even 'deleted' ones.
253 253
             $this->setDefaultCriteria(null);
254 254
             $record = $this->get($mixedParam, $sPropertyName);
255
-            if(isset($record)){
255
+            if (isset($record)) {
256 256
                 throw new AppDeletedRecordException($record, $mixedParam);
257 257
             }
258 258
             throw new AppNotFoundException($this, $mixedParam);
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
     public function selectLinkedTo($source, $linkType = null)
274 274
     {
275 275
         $linkSet = $this->App()->LinkSet();
276
-        if(is_array($source) || ($source instanceof \Iterator)){
276
+        if (is_array($source) || ($source instanceof \Iterator)) {
277 277
             return $linkSet->selectForSources($source, $this->getRecordClassName(), $linkType);
278 278
         }
279
-        else{
279
+        else {
280 280
             return $linkSet->selectForSource($source, $this->getRecordClassName(), $linkType);
281 281
         }
282 282
     }
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
     public function selectLinkedFrom($target, $linkType = null)
295 295
     {
296 296
         $linkSet = $this->App()->LinkSet();
297
-        if(is_array($target) || ($target instanceof \Iterator)){
297
+        if (is_array($target) || ($target instanceof \Iterator)) {
298 298
             return $linkSet->selectForTargets($target, $this->getRecordClassName(), $linkType);
299 299
         }
300
-        else{
300
+        else {
301 301
             return $linkSet->selectForTarget($target, $this->getRecordClassName(), $linkType);
302 302
         }
303 303
     }
@@ -321,11 +321,11 @@  discard block
 block discarded – undo
321 321
             ->_AND_($linkSet->targetId->is($target->id))
322 322
             ->_AND_($linkSet->sourceClass->is($this->newRecord()
323 323
             ->getClassName()));
324
-        if(isset($linkType)){
325
-            if(is_array($linkType)){
324
+        if (isset($linkType)) {
325
+            if (is_array($linkType)) {
326 326
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
327 327
             }
328
-            else{
328
+            else {
329 329
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
330 330
             }
331 331
         }
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
353 353
             ->_AND_($linkSet->sourceId->is($source->id))
354 354
             ->_AND_($linkSet->targetClass->is($this->newRecord()
355 355
             ->getClassName()));
356
-        if(isset($linkType)){
357
-            if(is_array($linkType)){
356
+        if (isset($linkType)) {
357
+            if (is_array($linkType)) {
358 358
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
359 359
             }
360
-            else{
360
+            else {
361 361
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
362 362
             }
363 363
         }
@@ -382,26 +382,26 @@  discard block
 block discarded – undo
382 382
         $linkSet->hasOne('targetId', $recordClassName);
383 383
         
384 384
         $sourceIdsByClasses = array();
385
-        foreach ($sources as $source){
385
+        foreach ($sources as $source) {
386 386
             $sourceClass = $source->getClassName();
387
-            if(! isset($sourceIdsByClasses[$sourceClass])){
387
+            if (!isset($sourceIdsByClasses[$sourceClass])) {
388 388
                 $sourceIdsByClasses[$sourceClass] = array();
389 389
             }
390 390
             $sourceIdsByClasses[$sourceClass][] = $source->id;
391 391
         }
392 392
         
393 393
         $sourcesCriteria = array();
394
-        foreach ($sourceIdsByClasses as $sourceClass => $sourceIds){
394
+        foreach ($sourceIdsByClasses as $sourceClass => $sourceIds) {
395 395
             $sourcesCriteria[] = $linkSet->sourceClass->is($sourceClass)->_AND_($linkSet->sourceId->in($sourceIds));
396 396
         }
397 397
         
398 398
         $criteria = $linkSet->all($linkSet->targetClass->is($this->newRecord()
399 399
             ->getClassName()), $linkSet->any($sourcesCriteria));
400
-        if(isset($linkType)){
401
-            if(is_array($linkType)){
400
+        if (isset($linkType)) {
401
+            if (is_array($linkType)) {
402 402
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
403 403
             }
404
-            else{
404
+            else {
405 405
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
406 406
             }
407 407
         }
@@ -426,26 +426,26 @@  discard block
 block discarded – undo
426 426
         $linkSet->hasOne('sourceId', $recordClassName);
427 427
         
428 428
         $targetIdsByClasses = array();
429
-        foreach ($targets as $target){
429
+        foreach ($targets as $target) {
430 430
             $targetClass = $target->getClassName();
431
-            if(! isset($targetIdsByClasses[$targetClass])){
431
+            if (!isset($targetIdsByClasses[$targetClass])) {
432 432
                 $targetIdsByClasses[$targetClass] = array();
433 433
             }
434 434
             $targetIdsByClasses[$targetClass][] = $target->id;
435 435
         }
436 436
         
437 437
         $targetsCriteria = array();
438
-        foreach ($targetIdsByClasses as $targetClass => $targetIds){
438
+        foreach ($targetIdsByClasses as $targetClass => $targetIds) {
439 439
             $targetsCriteria[] = $linkSet->targetClass->is($targetClass)->_AND_($linkSet->targetId->in($targetIds));
440 440
         }
441 441
         
442 442
         $criteria = $linkSet->all($linkSet->sourceClass->is($this->newRecord()
443 443
             ->getClassName()), $linkSet->any($targetsCriteria));
444
-        if(isset($linkType)){
445
-            if(is_array($linkType)){
444
+        if (isset($linkType)) {
445
+            if (is_array($linkType)) {
446 446
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
447 447
             }
448
-            else{
448
+            else {
449 449
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
450 450
             }
451 451
         }
@@ -560,19 +560,19 @@  discard block
 block discarded – undo
560 560
         $criteria = $linkSet->sourceClass->is($this->getRecordClassName())
561 561
             ->_AND_($linkSet->targetClass->is($tagClassName));
562 562
         
563
-        if(is_array($tagLabels)){
563
+        if (is_array($tagLabels)) {
564 564
             $criteria = $criteria->_AND_($linkSet->targetId->label->in($tagLabels));
565 565
         }
566
-        else{
566
+        else {
567 567
             $criteria = $criteria->_AND_($linkSet->targetId->label->is($tagLabels));
568 568
         }
569
-        if(isset($linkType)){
569
+        if (isset($linkType)) {
570 570
             $criteria = $criteria->_AND_($linkSet->type->is($linkType));
571 571
         }
572 572
         $links = $linkSet->select($criteria);
573 573
         
574 574
         $ids = array();
575
-        foreach ($links as $link){
575
+        foreach ($links as $link) {
576 576
             $ids[$link->sourceId] = $link->sourceId;
577 577
         }
578 578
         
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
     {
584 584
         $fields = $this->getFields();
585 585
         $manyRelations = $this->getHasManyRelations();
586
-        foreach ($manyRelations as $fieldName => $manyRelation){
586
+        foreach ($manyRelations as $fieldName => $manyRelation) {
587 587
             $fields[$fieldName] = $manyRelation;
588 588
         }
589 589
         return $fields;
Please login to merge, or discard this patch.
programs/Set/AppCustomFieldSet.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
             ORM_BoolField('visible')->setOutputOptions($App->translate('No'), $App->translate('Yes'))->setDescription($App->translate('Column in list'))
81 81
         );
82 82
         
83
-        if($App->onlineShop){
83
+        if ($App->onlineShop) {
84 84
             $this->addFields(ORM_BoolField('visible_in_shop'));
85 85
         }
86 86
     }
87 87
     
88 88
     public function save(ORMRecord $record, $noTrace = false)
89 89
     {
90
-        if(! $record->fieldname){
90
+        if (!$record->fieldname) {
91 91
             $record->fieldname = $this->getFieldName($record->name);
92 92
         }
93 93
         
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
         $name = preg_replace('/[^a-zA-Z0-9]+/', '', $name);
109 109
         $name = mb_strtolower($name);
110 110
         
111
-        if(empty($name)){
111
+        if (empty($name)) {
112 112
             throw new AppSaveException($this->App()->translate('The name is mandatory'));
113 113
         }
114 114
         
115
-        return '_' . $name;
115
+        return '_'.$name;
116 116
     }
117 117
     
118 118
     /**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         
127 127
         $arr = array();
128 128
         
129
-        if(isset($App->Article)){
129
+        if (isset($App->Article)) {
130 130
             $arr['Article'] = $App->translate('Products database');
131 131
         }
132 132
         
Please login to merge, or discard this patch.
programs/Set/AppLogSet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@
 block discarded – undo
75 75
     public function serialize(AppRecord $record)
76 76
     {
77 77
         $values = $record->getValues();
78
-        foreach ($values as $key => $value){
79
-            if($value instanceof ORMRecordSet){
78
+        foreach ($values as $key => $value) {
79
+            if ($value instanceof ORMRecordSet) {
80 80
                 $values[$key] = $value->id;
81 81
             }
82 82
         }
Please login to merge, or discard this patch.
programs/Ui/AppHelpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		if (empty($description)) {
72 72
 			$description = $field->getName();
73 73
 		}
74
-		$fieldLabel = $W->Label($description . ':');
74
+		$fieldLabel = $W->Label($description.':');
75 75
 
76 76
 		if ($field instanceof ORMDateField) {
77 77
 			$widget = $W->DatePicker();
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		if (empty($description)) {
128 128
 			$description = $field->getName();
129 129
 		}
130
-		$fieldLabel = $W->Label($description . ':');
130
+		$fieldLabel = $W->Label($description.':');
131 131
 
132 132
 		if ($field instanceof ORMDateField) {
133 133
 			$widget = $W->PeriodPicker();
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	$nbOptions = 0;
231 231
 	foreach ($iterator as $record) {
232 232
 		if (isset($record->code)) {
233
-			$optionText = $record->code . ' - ' . $record->$fieldName;
233
+			$optionText = $record->code.' - '.$record->$fieldName;
234 234
 		} else {
235 235
 			$optionText = $record->$fieldName;
236 236
 		}
Please login to merge, or discard this patch.
programs/Ui/AppCardFrame.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
 
137 137
         $displayable = $field->output($value);
138 138
 
139
-        switch(true) {
139
+        switch (true) {
140 140
             case ($field instanceof ORMTextField):
141 141
                 $displayable = $W->RichText($displayable)->setRenderingOptions(BAB_HTML_ALL ^ BAB_HTML_P);
142 142
                 break;
Please login to merge, or discard this patch.