Passed
Branchdevelop81 (6bbe30)
by Robin
08:10
created
programs/Exceptions/AppDeletedRecordException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function getDeletedBy()
55 55
     {
56
-        if(! $this->record->deletedBy){
56
+        if (!$this->record->deletedBy) {
57 57
             return null;
58 58
         }
59 59
         
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function getDeletedOn()
69 69
     {
70 70
         $set = $this->getRecordSet();
71
-        if(! $set->deletedOn->isValueSet($this->record->deletedOn)){
71
+        if (!$set->deletedOn->isValueSet($this->record->deletedOn)) {
72 72
             return null;
73 73
         }
74 74
         
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/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.
programs/Ui/AppCriteriaEditor.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -159,13 +159,11 @@  discard block
 block discarded – undo
159 159
                     
160 160
                     if($foreignRecordSetField instanceof ORMBoolInterface){
161 161
                         $booleanFieldPathes[] = $foreignPath;
162
-                    }
163
-                    else{
162
+                    } else{
164 163
                         $defaultFieldPathes[] = $foreignPath;
165 164
                     }
166 165
                 }
167
-            }
168
-            elseif($recordSetField instanceof ORMFkField){
166
+            } elseif($recordSetField instanceof ORMFkField){
169 167
                 /* @var $recordSetField ORMFkField */
170 168
                 $fieldDescription = $fieldName;
171 169
                 $path = $fieldName;
@@ -182,13 +180,11 @@  discard block
 block discarded – undo
182 180
                     
183 181
                     if($foreignRecordSetField instanceof ORMBoolInterface){
184 182
                         $booleanFieldPathes[] = $foreignPath;
185
-                    }
186
-                    else{
183
+                    } else{
187 184
                         $defaultFieldPathes[] = $foreignPath;
188 185
                     }
189 186
                 }
190
-            }
191
-            else{
187
+            } else{
192 188
                 /* @var $recordSetField ORMField */
193 189
                 $fieldName = $recordSetField->getName();
194 190
                 $fieldDescription = $recordSetField->getDescription();
@@ -204,8 +200,7 @@  discard block
 block discarded – undo
204 200
                 
205 201
                 if($recordSetField instanceof ORMBoolInterface){
206 202
                     $booleanFieldPathes[] = $path;
207
-                }
208
-                else{
203
+                } else{
209 204
                     $defaultFieldPathes[] = $path;
210 205
                 }
211 206
             }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function getRecordSet()
81 81
     {
82
-        if(isset($this->recordSet)){
82
+        if (isset($this->recordSet)) {
83 83
             return $this->recordSet;
84 84
         }
85 85
         
86 86
         $parentField = $this->criteria->getField();
87 87
         
88
-        if(! isset($parentField)){
88
+        if (!isset($parentField)) {
89 89
             return null;
90 90
         }
91 91
         
92
-        do{
92
+        do {
93 93
             $field = $parentField;
94 94
             $parentField = $field->getParentSet();
95 95
         }
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
         
143 143
         $classPrefix = $App->classPrefix;
144 144
         
145
-        foreach ($recordSetFields as $fieldName => $recordSetField){
146
-            if($recordSetField instanceof ORMManyRelation){
145
+        foreach ($recordSetFields as $fieldName => $recordSetField) {
146
+            if ($recordSetField instanceof ORMManyRelation) {
147 147
                 /* @var $recordSetField ORMManyRelation */
148 148
                 $fieldDescription = $fieldName;
149 149
                 $path = $fieldName;
@@ -152,31 +152,31 @@  discard block
 block discarded – undo
152 152
                 $foreignRecordSet = $App->$foreignSetName();
153 153
                 $foreignRecordSetFields = $foreignRecordSet->getVisibilityCriteriaFields();
154 154
                 
155
-                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField){
156
-                    if(!method_exists($foreignRecordSetField,'getName')){
155
+                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField) {
156
+                    if (!method_exists($foreignRecordSetField, 'getName')) {
157 157
                         continue;
158 158
                     }
159 159
                     $foreignFieldName = $foreignRecordSetField->getName();
160 160
                     $foreignFieldDescription = $foreignRecordSetField->getDescription();
161
-                    if(substr($foreignFieldName, 0, 1) !== '_'){
161
+                    if (substr($foreignFieldName, 0, 1) !== '_') {
162 162
                         $foreignFieldDescription = $App->translate($foreignFieldDescription);
163 163
                     }
164
-                    if(empty($foreignFieldDescription)){
164
+                    if (empty($foreignFieldDescription)) {
165 165
                         $foreignFieldDescription = $foreignFieldName;
166 166
                     }
167
-                    $foreignPath = $path . '/' . $foreignRecordSetField->getPath();
167
+                    $foreignPath = $path.'/'.$foreignRecordSetField->getPath();
168 168
                     
169 169
                     $recordSetFieldSelect->addOption($foreignPath, $foreignFieldDescription, $fieldName);
170 170
                     
171
-                    if($foreignRecordSetField instanceof ORMBoolInterface){
171
+                    if ($foreignRecordSetField instanceof ORMBoolInterface) {
172 172
                         $booleanFieldPathes[] = $foreignPath;
173 173
                     }
174
-                    else{
174
+                    else {
175 175
                         $defaultFieldPathes[] = $foreignPath;
176 176
                     }
177 177
                 }
178 178
             }
179
-            elseif($recordSetField instanceof ORMFkField){
179
+            elseif ($recordSetField instanceof ORMFkField) {
180 180
                 /* @var $recordSetField ORMFkField */
181 181
                 $fieldDescription = $fieldName;
182 182
                 $path = $fieldName;
@@ -185,38 +185,38 @@  discard block
 block discarded – undo
185 185
                 $foreignRecordSet = $App->$foreignSetName();
186 186
                 $foreignRecordSetFields = $foreignRecordSet->getVisibilityCriteriaFields();
187 187
                 
188
-                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField){
188
+                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField) {
189 189
                     $foreignFieldDescription = $foreignFieldName;
190
-                    $foreignPath = $path . '/' . $foreignFieldName;
190
+                    $foreignPath = $path.'/'.$foreignFieldName;
191 191
                     
192 192
                     $recordSetFieldSelect->addOption($foreignPath, $foreignFieldDescription, $fieldName);
193 193
                     
194
-                    if($foreignRecordSetField instanceof ORMBoolInterface){
194
+                    if ($foreignRecordSetField instanceof ORMBoolInterface) {
195 195
                         $booleanFieldPathes[] = $foreignPath;
196 196
                     }
197
-                    else{
197
+                    else {
198 198
                         $defaultFieldPathes[] = $foreignPath;
199 199
                     }
200 200
                 }
201 201
             }
202
-            else{
202
+            else {
203 203
                 /* @var $recordSetField ORMField */
204 204
                 $fieldName = $recordSetField->getName();
205 205
                 $fieldDescription = $recordSetField->getDescription();
206
-                if(substr($fieldName, 0, 1) !== '_'){
206
+                if (substr($fieldName, 0, 1) !== '_') {
207 207
                     $fieldDescription = $App->translate($fieldDescription);
208 208
                 }
209
-                if(empty($fieldDescription)){
209
+                if (empty($fieldDescription)) {
210 210
                     $fieldDescription = $fieldName;
211 211
                 }
212 212
                 $path = $recordSetField->getPath();
213 213
                 
214 214
                 $recordSetFieldSelect->addOption($path, $fieldDescription);
215 215
                 
216
-                if($recordSetField instanceof ORMBoolInterface){
216
+                if ($recordSetField instanceof ORMBoolInterface) {
217 217
                     $booleanFieldPathes[] = $path;
218 218
                 }
219
-                else{
219
+                else {
220 220
                     $defaultFieldPathes[] = $path;
221 221
                 }
222 222
             }
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlCustomContainer.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -264,8 +264,7 @@  discard block
 block discarded – undo
264 264
         $customSectionSet = $App->CustomContainerSet();
265 265
         if(isset($id)){
266 266
             $record = $customSectionSet->request($id);
267
-        }
268
-        else{
267
+        } else{
269 268
             $record = $customSectionSet->newRecord();
270 269
             $record->object = $object;
271 270
         }
@@ -522,8 +521,7 @@  discard block
 block discarded – undo
522 521
                     
523 522
                     if($selectedManyField instanceof ORMBoolInterface){
524 523
                         $condition = $condition['bool'];
525
-                    }
526
-                    else{
524
+                    } else{
527 525
                         $condition = $condition['default'];
528 526
                     }
529 527
                     
@@ -551,8 +549,7 @@  discard block
 block discarded – undo
551 549
                     
552 550
                     if($selectedOneField instanceof ORMBoolInterface){
553 551
                         $condition = $condition['bool'];
554
-                    }
555
-                    else{
552
+                    } else{
556 553
                         $condition = $condition['default'];
557 554
                     }
558 555
                     
@@ -561,15 +558,13 @@  discard block
 block discarded – undo
561 558
                 }
562 559
                 break;
563 560
             }
564
-        }
565
-        else{
561
+        } else{
566 562
             
567 563
             $field = $objectRecordSet->$field;
568 564
             
569 565
             if($field instanceof ORMBoolInterface){
570 566
                 $condition = $condition['bool'];
571
-            }
572
-            else{
567
+            } else{
573 568
                 $condition = $condition['default'];
574 569
             }
575 570
             
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
             ->_AND_($customSectionSet->object->is($customSection->object)));
74 74
         
75 75
         $allViewFieldNames = array();
76
-        foreach ($allViewSections as $viewSection){
76
+        foreach ($allViewSections as $viewSection) {
77 77
             $fields = $viewSection->getFields();
78
-            foreach ($fields as $field){
79
-                $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
78
+            foreach ($fields as $field) {
79
+                $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
80 80
             }
81 81
         }
82 82
         
83 83
         $box = $W->VBoxItems();
84
-        if(isset($itemId)){
84
+        if (isset($itemId)) {
85 85
             $box->setId($itemId);
86 86
         }
87 87
         
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         
97 97
         BabSort::asort($availableFields, 'description', BabSort::CASE_INSENSITIVE);
98 98
         
99
-        foreach ($availableFields as $field){
99
+        foreach ($availableFields as $field) {
100 100
             $fieldName = $field['name'];
101 101
             $fieldDescription = $field['description'];
102 102
             
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         
151 151
         $field = $customSection->getField($fieldName);
152 152
         
153
-        if(! isset($field)){
153
+        if (!isset($field)) {
154 154
             return null;
155 155
         }
156 156
         
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
         
167 167
         $field = $availableFields[$fieldName];
168 168
         $fieldDescription = $field['description'];
169
-        if(substr($fieldName, 0, 1) !== '_'){
169
+        if (substr($fieldName, 0, 1) !== '_') {
170 170
             $fieldDescription = $App->translate($fieldDescription);
171 171
         }
172 172
         
173
-        if(empty($field)){
173
+        if (empty($field)) {
174 174
             // continue;
175 175
         }
176 176
         
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
         $W = bab_Widgets();
272 272
         
273 273
         $customSectionSet = $App->CustomContainerSet();
274
-        if(isset($id)){
274
+        if (isset($id)) {
275 275
             $record = $customSectionSet->request($id);
276 276
         }
277
-        else{
277
+        else {
278 278
             $record = $customSectionSet->newRecord();
279 279
             $record->object = $object;
280 280
         }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         $editor = new AppEditor($App);
288 288
         $editor->setHiddenValue('tg', $App->controllerTg);
289 289
         $editor->setHiddenValue('data[view]', $view);
290
-        if($record->id){
290
+        if ($record->id) {
291 291
             $editor->setHiddenValue('data[id]', $record->id);
292 292
         }
293 293
         $editor->setName('data');
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
         $record = $recordSet->request($id);
366 366
         
367 367
         $object = $record->object;
368
-        if(empty($object)){
368
+        if (empty($object)) {
369 369
             $object = $record->container()->object;
370 370
         }
371
-        if(strpos($object, $App->classPrefix) !== false){
371
+        if (strpos($object, $App->classPrefix) !== false) {
372 372
             $object = str_replace($App->classPrefix, '', $object);
373 373
         }
374 374
         $object .= 'Set';
@@ -383,25 +383,25 @@  discard block
 block discarded – undo
383 383
         $manySets = $objectRecordSet->getHasManyRelations();
384 384
         $oneSets = $objectRecordSet->getHasOneRelations();
385 385
         
386
-        if(! empty($record->visibilityCriteria)){
386
+        if (!empty($record->visibilityCriteria)) {
387 387
             $arrCriteria = json_decode($record->visibilityCriteria, true);
388 388
             
389 389
             $data = array();
390
-            foreach ($arrCriteria as $fieldName => $operation){
390
+            foreach ($arrCriteria as $fieldName => $operation) {
391 391
                 $data['field'] = $fieldName;
392
-                foreach ($operation as $condition => $value){
392
+                foreach ($operation as $condition => $value) {
393 393
                     $data['condition']['default'] = $condition;
394 394
                     $data['condition']['bool'] = $condition;
395
-                    if(is_array($value)){
396
-                        foreach ($value as $key => $subValue){
397
-                            foreach ($manySets as $manyFieldName => $manyRelation){
398
-                                if($key . 'Set' == $manyRelation->getForeignSetClassName()){
399
-                                    foreach ($subValue as $subFieldName => $subConditions){
400
-                                        if($subFieldName === '_foreignField'){
395
+                    if (is_array($value)) {
396
+                        foreach ($value as $key => $subValue) {
397
+                            foreach ($manySets as $manyFieldName => $manyRelation) {
398
+                                if ($key.'Set' == $manyRelation->getForeignSetClassName()) {
399
+                                    foreach ($subValue as $subFieldName => $subConditions) {
400
+                                        if ($subFieldName === '_foreignField') {
401 401
                                             continue;
402 402
                                         }
403 403
                                         $data['field'] = "{$manyFieldName}/{$subFieldName}";
404
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
404
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
405 405
                                             $data['condition']['default'] = $subCondition;
406 406
                                             $data['condition']['bool'] = $subCondition;
407 407
                                             $value = $subConditionValue;
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
                                     break;
411 411
                                 }
412 412
                             }
413
-                            foreach ($oneSets as $oneFieldName => $oneRelation){
414
-                                if($key . 'Set' == $oneRelation->getForeignSetClassName()){
415
-                                    foreach ($subValue as $subFieldName => $subConditions){
416
-                                        if($subFieldName === '_foreignField'){
413
+                            foreach ($oneSets as $oneFieldName => $oneRelation) {
414
+                                if ($key.'Set' == $oneRelation->getForeignSetClassName()) {
415
+                                    foreach ($subValue as $subFieldName => $subConditions) {
416
+                                        if ($subFieldName === '_foreignField') {
417 417
                                             continue;
418 418
                                         }
419 419
                                         $data['field'] = "{$oneFieldName}/{$subFieldName}";
420
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
420
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
421 421
                                             $data['condition']['default'] = $subCondition;
422 422
                                             $data['condition']['bool'] = $subCondition;
423 423
                                             $value = $subConditionValue;
@@ -459,10 +459,10 @@  discard block
 block discarded – undo
459 459
         return true;
460 460
     }
461 461
     
462
-    protected function preSave(ORMRecord  &$record, $data)
462
+    protected function preSave(ORMRecord & $record, $data)
463 463
     {
464 464
         parent::preSave($record, $data);
465
-        if(! isset($record->id) || empty($record->id)){
465
+        if (!isset($record->id) || empty($record->id)) {
466 466
             $set = $record->getParentSet();
467 467
             $nbContainers = $set->select($set->all(array(
468 468
                 $set->object->is($record->object),
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
         $record = $recordSet->request($data['id']);
498 498
         
499 499
         $object = $record->object;
500
-        if(empty($object)){
500
+        if (empty($object)) {
501 501
             $object = $record->container()->object;
502 502
         }
503
-        if(strpos($object, $App->classPrefix) !== false){
503
+        if (strpos($object, $App->classPrefix) !== false) {
504 504
             $object = str_replace($App->classPrefix, '', $object);
505 505
         }
506 506
         $object .= 'Set';
@@ -511,14 +511,14 @@  discard block
 block discarded – undo
511 511
         $field = $data['field'];
512 512
         $condition = $data['condition'];
513 513
         
514
-        if(strpos($field, '/') !== false){
514
+        if (strpos($field, '/') !== false) {
515 515
             // The selected field is a hasMany or a hasOne relation
516 516
             list ($selectedRelation, $selectedField) = explode('/', $field);
517 517
             $classPrefix = $App->classPrefix;
518 518
             
519 519
             $manyRelations = $objectRecordSet->getHasManyRelations();
520
-            foreach ($manyRelations as $manyRelation){
521
-                if($selectedRelation != $manyRelation->getOwnerSetFieldName()){
520
+            foreach ($manyRelations as $manyRelation) {
521
+                if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) {
522 522
                     continue;
523 523
                 }
524 524
                 $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName());
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
                 
527 527
                 $visibilityCriteria = '';
528 528
                 
529
-                if($foreignSet){
529
+                if ($foreignSet) {
530 530
                     $selectedManyField = $foreignSet->$selectedField;
531 531
                     
532
-                    if($selectedManyField instanceof ORMBoolInterface){
532
+                    if ($selectedManyField instanceof ORMBoolInterface) {
533 533
                         $condition = $condition['bool'];
534 534
                     }
535
-                    else{
535
+                    else {
536 536
                         $condition = $condition['default'];
537 537
                     }
538 538
                     
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
             }
545 545
             
546 546
             $oneRelations = $objectRecordSet->getHasOneRelations();
547
-            foreach ($oneRelations as $oneRelation){
547
+            foreach ($oneRelations as $oneRelation) {
548 548
                 /* @var $oneRelation ORMOneRelation*/
549
-                if($selectedRelation != $oneRelation->getOwnerSetFieldName()){
549
+                if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) {
550 550
                     continue;
551 551
                 }
552 552
                 $foreignSetClassName = $oneRelation->getForeignSetClassName();
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
                 
556 556
                 $visibilityCriteria = '';
557 557
                 
558
-                if($foreignSet){
558
+                if ($foreignSet) {
559 559
                     $selectedOneField = $foreignSet->$selectedField;
560 560
                     
561
-                    if($selectedOneField instanceof ORMBoolInterface){
561
+                    if ($selectedOneField instanceof ORMBoolInterface) {
562 562
                         $condition = $condition['bool'];
563 563
                     }
564
-                    else{
564
+                    else {
565 565
                         $condition = $condition['default'];
566 566
                     }
567 567
                     
@@ -571,20 +571,20 @@  discard block
 block discarded – undo
571 571
                 break;
572 572
             }
573 573
         }
574
-        else{
574
+        else {
575 575
             
576 576
             $field = $objectRecordSet->$field;
577 577
             
578
-            if($field instanceof ORMBoolInterface){
578
+            if ($field instanceof ORMBoolInterface) {
579 579
                 $condition = $condition['bool'];
580 580
             }
581
-            else{
581
+            else {
582 582
                 $condition = $condition['default'];
583 583
             }
584 584
             
585 585
             $visibilityCriteria = '';
586 586
             
587
-            if(! empty($condition)){
587
+            if (!empty($condition)) {
588 588
                 $criteria = $field->{$condition}($data['value']);
589 589
                 $visibilityCriteria = $criteria->toJson();
590 590
             }
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
         
620 620
         $containerBoxes = $W->Items();
621 621
         
622
-        foreach ($customContainers as $customContainer){
622
+        foreach ($customContainers as $customContainer) {
623 623
             
624 624
             $menu = $W->HBoxItems($W->Link('', $customSectionCtrl->edit($customContainer->id))
625 625
                 ->addClass('icon', FuncIcons::ACTIONS_LIST_ADD)
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
             $menu->setSizePolicy(FuncIcons::ICON_LEFT_16);
635 635
             
636 636
             $hasVisibilityBox = $W->FlowItems()->addClass('widget-100');
637
-            if(! empty($customContainer->visibilityCriteria)){
637
+            if (!empty($customContainer->visibilityCriteria)) {
638 638
                 $hasVisibilityBox->addItem($W->HBoxItems($W->Label($App->translate('This container has a visibility condition')))
639 639
                     ->setSizePolicy('alert alert-warning widget-100pc'));
640 640
             }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
                 ->addClass($customContainer->classname));
646 646
         }
647 647
         
648
-        if(isset($itemId)){
648
+        if (isset($itemId)) {
649 649
             $containerBoxes->setId($itemId);
650 650
         }
651 651
         
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
         $customSectionSet = $App->CustomSectionSet();
672 672
         
673 673
         $containersValues = array();
674
-        foreach ($customContainers as $customContainer){
674
+        foreach ($customContainers as $customContainer) {
675 675
             $values = $customContainer->getValues();
676 676
             unset($values['id']);
677 677
             unset($values['uuid']);
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
             unset($values['deleted']);
685 685
             $values['customSections'] = array();
686 686
             $customSections = $customSectionSet->select($customSectionSet->container->is($customContainer->id));
687
-            foreach ($customSections as $customSection){
687
+            foreach ($customSections as $customSection) {
688 688
                 $customSectionValues = $customSection->getValues();
689 689
                 unset($customSectionValues['id']);
690 690
                 unset($customSectionValues['uuid']);
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
         }
704 704
         
705 705
         header('Content-type: application/json');
706
-        header('Content-Disposition: attachment; filename="' . $object . '.' . ($view === '' ? 'default' : $view) . '.json"' . "\n");
707
-        if(BabCharset::getIso() != BabCharset::UTF_8){
706
+        header('Content-Disposition: attachment; filename="'.$object.'.'.($view === '' ? 'default' : $view).'.json"'."\n");
707
+        if (BabCharset::getIso() != BabCharset::UTF_8) {
708 708
             $containersValues = app_utf8Encode($containersValues);
709 709
         }
710 710
         $json = bab_json_encode($containersValues);
@@ -763,12 +763,12 @@  discard block
 block discarded – undo
763 763
         $files->push($containersfile['uid']);
764 764
         
765 765
         $data = null;
766
-        foreach ($files as $f){
766
+        foreach ($files as $f) {
767 767
             $data = file_get_contents($f->toString());
768 768
             break;
769 769
         }
770 770
         
771
-        if(! isset($data)){
771
+        if (!isset($data)) {
772 772
             $this->addError($App->translate('Unable to get file content'));
773 773
             return true;
774 774
         }
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
         $customContainerSet->delete($customContainerSet->view->is($view)
785 785
             ->_AND_($customContainerSet->object->is($object)));
786 786
         
787
-        foreach ($containersValues as $containerValues){
787
+        foreach ($containersValues as $containerValues) {
788 788
             $customContainer = $customContainerSet->newRecord();
789 789
             $customContainer->setValues($containerValues);
790 790
             $customContainer->object = $object;
791 791
             $customContainer->view = $view;
792 792
             $customContainer->save();
793
-            foreach ($containerValues['customSections'] as $sectionValues){
793
+            foreach ($containerValues['customSections'] as $sectionValues) {
794 794
                 $customSection = $customSectionSet->newRecord();
795 795
                 $sectionValues['fields'] = json_encode($sectionValues['fields']);
796 796
                 $customSection->setValues($sectionValues);
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
         
925 925
         $rank = 0;
926 926
         $currentContainerId = 0;
927
-        foreach (array_keys($containers) as $containerFieldId){
927
+        foreach (array_keys($containers) as $containerFieldId) {
928 928
             
929
-            if(substr($containerFieldId, 0, 1) === '#'){
929
+            if (substr($containerFieldId, 0, 1) === '#') {
930 930
                 $currentContainerId = substr($containerFieldId, 1);
931 931
                 
932 932
                 $customContainer = $customContainerSet->request($customContainerSet->id->is($currentContainerId));
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                 $containersRawFields[$currentContainerId] = $customContainer->getRawFields();
936 936
                 
937 937
                 $customContainer->rank = $rank;
938
-                $rank ++;
938
+                $rank++;
939 939
                 $customContainer->save();
940 940
                 continue;
941 941
             }
@@ -943,18 +943,18 @@  discard block
 block discarded – undo
943 943
             $containersFields[$currentContainerId][] = $containerFieldId;
944 944
         }
945 945
         
946
-        foreach ($containersFields as $containerId => $containerFieldIds){
947
-            foreach ($containerFieldIds as $containerFieldId){
946
+        foreach ($containersFields as $containerId => $containerFieldIds) {
947
+            foreach ($containerFieldIds as $containerFieldId) {
948 948
                 list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId);
949
-                if(! isset($containersRawFields[$srcContainerId][$srcfieldId])){
949
+                if (!isset($containersRawFields[$srcContainerId][$srcfieldId])) {
950 950
                     return true;
951 951
                 }
952 952
             }
953 953
         }
954 954
         
955
-        foreach ($containersFields as $containerId => $containerFieldIds){
955
+        foreach ($containersFields as $containerId => $containerFieldIds) {
956 956
             $newRawFields = array();
957
-            foreach ($containerFieldIds as $containerFieldId){
957
+            foreach ($containerFieldIds as $containerFieldId) {
958 958
                 list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId);
959 959
                 $newRawFields[] = $containersRawFields[$srcContainerId][$srcfieldId];
960 960
             }
Please login to merge, or discard this patch.
programs/AppAccessManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
     public function hasNoAccess(AppRecordSet $recordSet, $accessType, $user = null)
94 94
     {
95 95
         $criterion = $this->getAccessCriterion($recordSet, $accessType, $user);
96
-        if(! $criterion instanceof ORMFalseCriterion){
96
+        if (!$criterion instanceof ORMFalseCriterion) {
97 97
             return false;
98 98
         }
99 99
         return true;
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlSSE.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
         
48 48
         $refreshFrequency = $this->getRefreshFrequency();
49 49
         
50
-        while (1){
51
-            if(connection_aborted()){
50
+        while (1) {
51
+            if (connection_aborted()) {
52 52
                 exit();
53 53
             }
54 54
             $data = $this->getSSEData();
55
-            if($data != '{}'){
55
+            if ($data != '{}') {
56 56
                 echo "event: ping\n";
57 57
                 echo "\n\n";
58
-                echo 'data: ' . $this->getSSEData() . "\n\n";
58
+                echo 'data: '.$this->getSSEData()."\n\n";
59 59
             }
60 60
             ob_end_flush();
61 61
             flush();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     
80 80
     private function getRefreshFrequency()
81 81
     {
82
-        if(! isset($this->refreshFrequency)){
82
+        if (!isset($this->refreshFrequency)) {
83 83
             $registry = app_getRegistry();
84 84
             $registry->changeDirectory('configuration');
85 85
             $registry->changeDirectory('SSE');
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     
99 99
     private function getCurrentUser()
100 100
     {
101
-        if(isset($this->currentUser)){
101
+        if (isset($this->currentUser)) {
102 102
             return $this->currentUser;
103 103
         }
104 104
         
Please login to merge, or discard this patch.
programs/functions.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     if (null === $url) {
111 111
         $script = '<script type="text/javascript">';
112 112
         if (isset($message)) {
113
-            $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");';
113
+            $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");';
114 114
         }
115 115
         $script .= 'history.back();';
116 116
         $script .= '</script>';
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $url = $url->url();
123 123
     }
124 124
     if (!empty($babBody->msgerror)) {
125
-        $url .=  '&msgerror=' . urlencode($babBody->msgerror);
125
+        $url .= '&msgerror='.urlencode($babBody->msgerror);
126 126
     }
127 127
     if (isset($message)) {
128 128
         $lines = explode("\n", $message);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         }
132 132
     }
133 133
 
134
-    header('Location: ' . $url);
134
+    header('Location: '.$url);
135 135
     die;
136 136
 }
137 137
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function app_fileUploadError($error)
165 165
 {
166
-    switch($error) {
166
+    switch ($error) {
167 167
         case UPLOAD_ERR_OK:
168 168
             return null;
169 169
 
@@ -274,25 +274,25 @@  discard block
 block discarded – undo
274 274
     return $imageUrl;
275 275
 }
276 276
 
277
-function app_utf8Decode($input){
278
-    if(is_array($input)){
277
+function app_utf8Decode($input) {
278
+    if (is_array($input)) {
279 279
         $return = array();
280
-        foreach($input as $k=>$v){
280
+        foreach ($input as $k=>$v) {
281 281
             $return[utf8_decode($k)] = app_utf8Decode($v);
282 282
         }
283
-    }else{
283
+    } else {
284 284
         return utf8_decode($input);
285 285
     }
286 286
     return $return;
287 287
 }
288 288
 
289
-function app_utf8Encode($input){
290
-    if(is_array($input)){
289
+function app_utf8Encode($input) {
290
+    if (is_array($input)) {
291 291
         $return = array();
292
-        foreach($input as $k=>$v){
292
+        foreach ($input as $k=>$v) {
293 293
             $return[app_utf8Encode($k)] = app_utf8Encode($v);
294 294
         }
295
-    }else{
295
+    } else {
296 296
         return utf8_encode($input);
297 297
     }
298 298
     return $return;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         foreach($input as $k=>$v){
281 281
             $return[utf8_decode($k)] = app_utf8Decode($v);
282 282
         }
283
-    }else{
283
+    } else{
284 284
         return utf8_decode($input);
285 285
     }
286 286
     return $return;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         foreach($input as $k=>$v){
293 293
             $return[app_utf8Encode($k)] = app_utf8Encode($v);
294 294
         }
295
-    }else{
295
+    } else{
296 296
         return utf8_encode($input);
297 297
     }
298 298
     return $return;
Please login to merge, or discard this patch.
programs/Set/AppRecordSet.php 3 patches
Braces   +10 added lines, -19 removed lines patch added patch discarded remove patch
@@ -180,8 +180,7 @@  discard block
 block discarded – undo
180 180
                         
181 181
                         /*@var $customfield AppCustomField */
182 182
                     }
183
-                }
184
-                catch (ORMBackEndSelectException $e){
183
+                } catch (ORMBackEndSelectException $e){
185 184
                     // table does not exist, this error is thrown by the install program while creating the sets
186 185
                 }
187 186
             }
@@ -218,8 +217,7 @@  discard block
 block discarded – undo
218 217
             if($ormField instanceof ORMFkField){
219 218
                 $this->hasOne($customField->fieldname, $ormField->getForeignSetName())
220 219
                     ->setDescription($description);
221
-            }
222
-            else{
220
+            } else{
223 221
                 $this->addFields($ormField);
224 222
             }
225 223
         }
@@ -282,8 +280,7 @@  discard block
 block discarded – undo
282 280
         
283 281
         if(is_array($source) || ($source instanceof \Iterator)){
284 282
             return $linkSet->selectForSources($source, $targetClass, $linkType);
285
-        }
286
-        else{
283
+        } else{
287 284
             return $linkSet->selectForSource($source, $targetClass, $linkType);
288 285
         }
289 286
     }
@@ -309,8 +306,7 @@  discard block
 block discarded – undo
309 306
         
310 307
         if(is_array($target) || ($target instanceof \Iterator)){
311 308
             return $linkSet->selectForTargets($target, $sourceClass, $linkType);
312
-        }
313
-        else{
309
+        } else{
314 310
             return $linkSet->selectForTarget($target, $sourceClass, $linkType);
315 311
         }
316 312
     }
@@ -345,8 +341,7 @@  discard block
 block discarded – undo
345 341
         if(isset($linkType)){
346 342
             if(is_array($linkType)){
347 343
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
348
-            }
349
-            else{
344
+            } else{
350 345
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
351 346
             }
352 347
         }
@@ -389,8 +384,7 @@  discard block
 block discarded – undo
389 384
         if(isset($linkType)){
390 385
             if(is_array($linkType)){
391 386
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
392
-            }
393
-            else{
387
+            } else{
394 388
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
395 389
             }
396 390
         }
@@ -443,8 +437,7 @@  discard block
 block discarded – undo
443 437
         if(isset($linkType)){
444 438
             if(is_array($linkType)){
445 439
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
446
-            }
447
-            else{
440
+            } else{
448 441
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
449 442
             }
450 443
         }
@@ -497,8 +490,7 @@  discard block
 block discarded – undo
497 490
         if(isset($linkType)){
498 491
             if(is_array($linkType)){
499 492
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
500
-            }
501
-            else{
493
+            } else{
502 494
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
503 495
             }
504 496
         }
@@ -615,8 +607,7 @@  discard block
 block discarded – undo
615 607
         
616 608
         if(is_array($tagLabels)){
617 609
             $criteria = $criteria->_AND_($linkSet->targetId->label->in($tagLabels));
618
-        }
619
-        else{
610
+        } else{
620 611
             $criteria = $criteria->_AND_($linkSet->targetId->label->is($tagLabels));
621 612
         }
622 613
         if(isset($linkType)){
@@ -652,7 +643,7 @@  discard block
 block discarded – undo
652 643
     public function getDisplayNameField(){
653 644
         if($this->fieldExist("name")){
654 645
             return $this->name;
655
-        }else{
646
+        } else{
656 647
             return $this->id;
657 648
         }
658 649
     }
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -182,16 +182,16 @@
 block discarded – undo
182 182
     
183 183
 
184 184
         /**
185
-     * Specifies that the recordset is linked to one element of the recordset of class $foreignSetClassName.
186
-     *
187
-     * @param string $fieldName
188
-     *            Field name of the set that have a link
189
-     * @param string $foreignSetClassName
190
-     *            Class name of the set on which the field is bound
191
-     * @param string $fieldClassName
192
-     *            Class name of the field to use as foreign key
193
-     * @return ORMFkField
194
-     */
185
+         * Specifies that the recordset is linked to one element of the recordset of class $foreignSetClassName.
186
+         *
187
+         * @param string $fieldName
188
+         *            Field name of the set that have a link
189
+         * @param string $foreignSetClassName
190
+         *            Class name of the set on which the field is bound
191
+         * @param string $fieldClassName
192
+         *            Class name of the field to use as foreign key
193
+         * @return ORMFkField
194
+         */
195 195
     public function hasOne($fieldName, $foreignSetClassName, $fieldClassName = 'ORMIntField',$App = null)
196 196
     {
197 197
         $ownerSetClassName = get_class($this);
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     protected function addTraitsFields()
109 109
     {
110
-        if($this->usesWebIdTrait()){
110
+        if ($this->usesWebIdTrait()) {
111 111
             $this->addWebIdField();
112 112
         }
113 113
     }
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
      */
137 137
     protected function trimSetName($setName)
138 138
     {
139
-        if(strpos($setName, '_') === false){
139
+        if (strpos($setName, '_') === false) {
140 140
             return $setName;
141 141
         }
142 142
         $pos = strrpos($setName, '\\');
143
-        if($pos === false){
143
+        if ($pos === false) {
144 144
             return explode('_', $setName)[1];
145 145
         }
146 146
         return substr($setName, $pos + 1);
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
     public function join($fkFieldName)
156 156
     {
157 157
         $fkField = $this->getField($fkFieldName);
158
-        if(! ($fkField instanceof ORMFkField)){
158
+        if (!($fkField instanceof ORMFkField)) {
159 159
             return $this;
160 160
         }
161 161
         $setName = $fkField->getForeignSetName();
162 162
         
163
-        if(! $setName || 'Set' === $setName){
164
-            throw new \Exception('The set name is missing on foreign key field ' . $fkFieldName);
163
+        if (!$setName || 'Set' === $setName) {
164
+            throw new \Exception('The set name is missing on foreign key field '.$fkFieldName);
165 165
         }
166 166
         
167 167
         $appSetName = $this->trimSetName($setName);
168 168
         $set = $fkField->App()->$appSetName();
169 169
 
170
-        if($fkField instanceof AppDynamicFkField){
170
+        if ($fkField instanceof AppDynamicFkField) {
171 171
             $set->setDynamicallyJoined();
172 172
             $set->setComputedJoinQuery($fkField->getComputedQuery($this->getBackend()));
173 173
         }
@@ -192,41 +192,41 @@  discard block
 block discarded – undo
192 192
      *            Class name of the field to use as foreign key
193 193
      * @return ORMFkField
194 194
      */
195
-    public function hasOne($fieldName, $foreignSetClassName, $fieldClassName = 'ORMIntField',$App = null)
195
+    public function hasOne($fieldName, $foreignSetClassName, $fieldClassName = 'ORMIntField', $App = null)
196 196
     {
197 197
         $ownerSetClassName = get_class($this);
198 198
         $ownerSetFieldName = $fieldName;
199 199
         
200
-        if(substr($foreignSetClassName, - 3, 3) !== 'Set'){
201
-            $foreignSetClassName = $foreignSetClassName . 'Set';
200
+        if (substr($foreignSetClassName, - 3, 3) !== 'Set') {
201
+            $foreignSetClassName = $foreignSetClassName.'Set';
202 202
         }
203 203
         
204 204
         $oRelations = bab_getInstance('Capwelton\LibOrm\MySql\ORMRelations');
205 205
         $oRelations->addRelation(new ORMOneRelation($ownerSetClassName, $ownerSetFieldName, $foreignSetClassName));
206 206
         
207 207
         $this->addFields(new AppFkField($fieldName, $foreignSetClassName, false, null, $fieldClassName));
208
-        if($App == null){
208
+        if ($App == null) {
209 209
             $App = $this->App();
210 210
         }
211 211
         $this->$fieldName->setApp($App);
212 212
         return $this->$fieldName;
213 213
     }
214 214
     
215
-    public function hasDynamicOne($fieldName,$foreignSetClassName,$criterias,$App = null){
215
+    public function hasDynamicOne($fieldName, $foreignSetClassName, $criterias, $App = null) {
216 216
         $ownerSetClassName = get_class($this);
217 217
         $ownerSetFieldName = $fieldName;
218 218
         
219
-        if(substr($foreignSetClassName, - 3, 3) !== 'Set'){
220
-            $foreignSetClassName = $foreignSetClassName . 'Set';
219
+        if (substr($foreignSetClassName, - 3, 3) !== 'Set') {
220
+            $foreignSetClassName = $foreignSetClassName.'Set';
221 221
         }
222 222
         
223 223
         $oRelations = bab_getInstance('Capwelton\LibOrm\MySql\ORMRelations');
224 224
         $oRelations->addRelation(new ORMOneRelation($ownerSetClassName, $ownerSetFieldName, $foreignSetClassName));
225 225
         
226
-        if($App == null){
226
+        if ($App == null) {
227 227
             $App = $this->App();
228 228
         }
229
-        $this->addFields(new AppDynamicFkField($fieldName, $foreignSetClassName, false, null,'ORMIntField',$App));
229
+        $this->addFields(new AppDynamicFkField($fieldName, $foreignSetClassName, false, null, 'ORMIntField', $App));
230 230
         
231 231
         $this->$fieldName->setApp($App);
232 232
         return $this->$fieldName;
@@ -257,22 +257,22 @@  discard block
 block discarded – undo
257 257
     {
258 258
         $App = $this->App();
259 259
         
260
-        if(null === $this->customFields){
260
+        if (null === $this->customFields) {
261 261
             $this->customFields = array();
262 262
             
263
-            if(isset($App->CustomField)){
263
+            if (isset($App->CustomField)) {
264 264
                 $customFieldSet = $App->CustomFieldSet();
265 265
                 $object = mb_substr(get_class($this), mb_strlen($App->classPrefix), - mb_strlen('Set'));
266
-                try{
266
+                try {
267 267
                     $customFields = $customFieldSet->select($customFieldSet->object->is($object));
268 268
                     
269
-                    foreach ($customFields as $customfield){
269
+                    foreach ($customFields as $customfield) {
270 270
                         $this->customFields[] = $customfield;
271 271
                         
272 272
                         /*@var $customfield AppCustomField */
273 273
                     }
274 274
                 }
275
-                catch (ORMBackEndSelectException $e){
275
+                catch (ORMBackEndSelectException $e) {
276 276
                     // table does not exist, this error is thrown by the install program while creating the sets
277 277
                 }
278 278
             }
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
     public function addCustomFields()
303 303
     {
304 304
         $customFields = $this->selectCustomFields();
305
-        foreach ($customFields as $customField){
305
+        foreach ($customFields as $customField) {
306 306
             /*@var $customField AppCustomField */
307 307
             $description = $customField->name;
308 308
             $ormField = $customField->getORMField()->setDescription($description);
309
-            if($ormField instanceof ORMFkField){
309
+            if ($ormField instanceof ORMFkField) {
310 310
                 $this->hasOne($customField->fieldname, $ormField->getForeignSetName())
311 311
                     ->setDescription($description);
312 312
             }
313
-            else{
313
+            else {
314 314
                 $this->addFields($ormField);
315 315
             }
316 316
         }
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
     public function request($mixedParam = null, $sPropertyName = null)
340 340
     {
341 341
         $record = $this->get($mixedParam, $sPropertyName);
342
-        if(! isset($record)){
342
+        if (!isset($record)) {
343 343
             // This will remove the default criteria for TraceableRecords and
344 344
             // fetch even 'deleted' ones.
345 345
             $this->setDefaultCriteria(null);
346 346
             $record = $this->get($mixedParam, $sPropertyName);
347
-            if(isset($record)){
347
+            if (isset($record)) {
348 348
                 throw new AppDeletedRecordException($record, $mixedParam);
349 349
             }
350 350
             throw new AppNotFoundException($this, $mixedParam);
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
         $linkSet = $this->App()->LinkSet();
368 368
         
369 369
         $targetClass = $this->getRecordClassName();
370
-        if(strpos($targetClass, '\\')){
370
+        if (strpos($targetClass, '\\')) {
371 371
             $targetClass = (new \ReflectionClass($targetClass))->getShortName();
372 372
         }
373 373
         
374
-        if(is_array($source) || ($source instanceof \Iterator)){
374
+        if (is_array($source) || ($source instanceof \Iterator)) {
375 375
             return $linkSet->selectForSources($source, $targetClass, $linkType);
376 376
         }
377
-        else{
377
+        else {
378 378
             return $linkSet->selectForSource($source, $targetClass, $linkType);
379 379
         }
380 380
     }
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
         $linkSet = $this->App()->LinkSet();
395 395
         
396 396
         $sourceClass = $this->getRecordClassName();
397
-        if(strpos($sourceClass, '\\')){
397
+        if (strpos($sourceClass, '\\')) {
398 398
             $sourceClass = (new \ReflectionClass($sourceClass))->getShortName();
399 399
         }
400 400
         
401
-        if(is_array($target) || ($target instanceof \Iterator)){
401
+        if (is_array($target) || ($target instanceof \Iterator)) {
402 402
             return $linkSet->selectForTargets($target, $sourceClass, $linkType);
403 403
         }
404
-        else{
404
+        else {
405 405
             return $linkSet->selectForTarget($target, $sourceClass, $linkType);
406 406
         }
407 407
     }
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
         $linkSet = $App->LinkSet();
420 420
         
421 421
         $recordClassName = $this->getRecordClassName();
422
-        if(strpos($recordClassName, '\\')){
422
+        if (strpos($recordClassName, '\\')) {
423 423
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
424 424
         }
425 425
         $linkSet->hasOne('sourceId', $recordClassName);
426 426
         
427 427
         $targetClass = $target->getClassName();
428
-        if(strpos($targetClass, '\\')){
428
+        if (strpos($targetClass, '\\')) {
429 429
             $targetClass = (new \ReflectionClass($targetClass))->getShortName();
430 430
         }
431 431
         
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
             ->_AND_($linkSet->targetId->is($target->id))
434 434
             ->_AND_($linkSet->sourceClass->is($this->newRecord()
435 435
             ->getClassName()));
436
-        if(isset($linkType)){
437
-            if(is_array($linkType)){
436
+        if (isset($linkType)) {
437
+            if (is_array($linkType)) {
438 438
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
439 439
             }
440
-            else{
440
+            else {
441 441
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
442 442
             }
443 443
         }
@@ -459,29 +459,29 @@  discard block
 block discarded – undo
459 459
         $linkSet = $App->LinkSet();
460 460
         
461 461
         $recordClassName = $this->getRecordClassName();
462
-        if(strpos($recordClassName, '\\')){
462
+        if (strpos($recordClassName, '\\')) {
463 463
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
464 464
         }
465 465
         $linkSet->hasOne('targetId', $recordClassName);
466 466
         
467 467
         $sourceClass = $source->getClassName();
468
-        if(strpos($sourceClass, '\\')){
468
+        if (strpos($sourceClass, '\\')) {
469 469
             $sourceClass = new \ReflectionClass($sourceClass);
470 470
         }
471 471
         
472 472
         $targetClass = $this->newRecord()->getClassName();
473
-        if(strpos($targetClass, '\\')){
473
+        if (strpos($targetClass, '\\')) {
474 474
             $targetClass = new \ReflectionClass($targetClass);
475 475
         }
476 476
         
477 477
         $criteria = $linkSet->sourceClass->is($sourceClass)
478 478
             ->_AND_($linkSet->sourceId->is($source->id))
479 479
             ->_AND_($linkSet->targetClass->is($targetClass));
480
-        if(isset($linkType)){
481
-            if(is_array($linkType)){
480
+        if (isset($linkType)) {
481
+            if (is_array($linkType)) {
482 482
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
483 483
             }
484
-            else{
484
+            else {
485 485
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
486 486
             }
487 487
         }
@@ -503,39 +503,39 @@  discard block
 block discarded – undo
503 503
         $App = $this->App();
504 504
         $linkSet = $App->LinkSet();
505 505
         $recordClassName = $linkSet->getRecordClassName();
506
-        if(strpos($recordClassName, '\\')){
506
+        if (strpos($recordClassName, '\\')) {
507 507
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
508 508
         }
509 509
         $linkSet->hasOne('targetId', $recordClassName);
510 510
         
511 511
         $sourceIdsByClasses = array();
512
-        foreach ($sources as $source){
512
+        foreach ($sources as $source) {
513 513
             $sourceClass = $source->getClassName();
514
-            if(strpos($sourceClass, '\\')){
514
+            if (strpos($sourceClass, '\\')) {
515 515
                 $sourceClass = (new \ReflectionClass($sourceClass))->getShortName();
516 516
             }
517
-            if(! isset($sourceIdsByClasses[$sourceClass])){
517
+            if (!isset($sourceIdsByClasses[$sourceClass])) {
518 518
                 $sourceIdsByClasses[$sourceClass] = array();
519 519
             }
520 520
             $sourceIdsByClasses[$sourceClass][] = $source->id;
521 521
         }
522 522
         
523 523
         $sourcesCriteria = array();
524
-        foreach ($sourceIdsByClasses as $sourceClass => $sourceIds){
524
+        foreach ($sourceIdsByClasses as $sourceClass => $sourceIds) {
525 525
             $sourcesCriteria[] = $linkSet->sourceClass->is($sourceClass)->_AND_($linkSet->sourceId->in($sourceIds));
526 526
         }
527 527
         
528 528
         $targetClass = $this->newRecord()->getClassName();
529
-        if(strpos($targetClass, '\\')){
529
+        if (strpos($targetClass, '\\')) {
530 530
             $targetClass = (new \ReflectionClass($targetClass))->getShortName();
531 531
         }
532 532
         
533 533
         $criteria = $linkSet->all($linkSet->targetClass->is($targetClass), $linkSet->any($sourcesCriteria));
534
-        if(isset($linkType)){
535
-            if(is_array($linkType)){
534
+        if (isset($linkType)) {
535
+            if (is_array($linkType)) {
536 536
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
537 537
             }
538
-            else{
538
+            else {
539 539
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
540 540
             }
541 541
         }
@@ -557,39 +557,39 @@  discard block
 block discarded – undo
557 557
         $App = $this->App();
558 558
         $linkSet = $App->LinkSet();
559 559
         $recordClassName = $this->getRecordClassName();
560
-        if(strpos($recordClassName, '\\')){
560
+        if (strpos($recordClassName, '\\')) {
561 561
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
562 562
         }
563 563
         $linkSet->hasOne('sourceId', $recordClassName);
564 564
         
565 565
         $targetIdsByClasses = array();
566
-        foreach ($targets as $target){
566
+        foreach ($targets as $target) {
567 567
             $targetClass = $target->getClassName();
568
-            if(strpos($targetClass, '\\')){
568
+            if (strpos($targetClass, '\\')) {
569 569
                 $targetClass = (new \ReflectionClass($targetClass))->getShortName();
570 570
             }
571
-            if(! isset($targetIdsByClasses[$targetClass])){
571
+            if (!isset($targetIdsByClasses[$targetClass])) {
572 572
                 $targetIdsByClasses[$targetClass] = array();
573 573
             }
574 574
             $targetIdsByClasses[$targetClass][] = $target->id;
575 575
         }
576 576
         
577 577
         $targetsCriteria = array();
578
-        foreach ($targetIdsByClasses as $targetClass => $targetIds){
578
+        foreach ($targetIdsByClasses as $targetClass => $targetIds) {
579 579
             $targetsCriteria[] = $linkSet->targetClass->is($targetClass)->_AND_($linkSet->targetId->in($targetIds));
580 580
         }
581 581
         
582 582
         $sourceClass = $this->newRecord()->getClassName();
583
-        if(strpos($sourceClass, '\\')){
583
+        if (strpos($sourceClass, '\\')) {
584 584
             $sourceClass = (new \ReflectionClass($sourceClass))->getShortName();
585 585
         }
586 586
         
587 587
         $criteria = $linkSet->all($linkSet->sourceClass->is($sourceClass), $linkSet->any($targetsCriteria));
588
-        if(isset($linkType)){
589
-            if(is_array($linkType)){
588
+        if (isset($linkType)) {
589
+            if (is_array($linkType)) {
590 590
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
591 591
             }
592
-            else{
592
+            else {
593 593
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
594 594
             }
595 595
         }
@@ -704,19 +704,19 @@  discard block
 block discarded – undo
704 704
         $criteria = $linkSet->sourceClass->is((new \ReflectionClass($this->getRecordClassName()))->getShortName())
705 705
             ->_AND_($linkSet->targetClass->is($tagClassName));
706 706
         
707
-        if(is_array($tagLabels)){
707
+        if (is_array($tagLabels)) {
708 708
             $criteria = $criteria->_AND_($linkSet->targetId->label->in($tagLabels));
709 709
         }
710
-        else{
710
+        else {
711 711
             $criteria = $criteria->_AND_($linkSet->targetId->label->is($tagLabels));
712 712
         }
713
-        if(isset($linkType)){
713
+        if (isset($linkType)) {
714 714
             $criteria = $criteria->_AND_($linkSet->type->is($linkType));
715 715
         }
716 716
         $links = $linkSet->select($criteria);
717 717
         
718 718
         $ids = array();
719
-        foreach ($links as $link){
719
+        foreach ($links as $link) {
720 720
             $ids[$link->sourceId] = $link->sourceId;
721 721
         }
722 722
         
@@ -727,31 +727,31 @@  discard block
 block discarded – undo
727 727
     {
728 728
         $fields = $this->getFields();
729 729
         $manyRelations = $this->getHasManyRelations();
730
-        foreach ($manyRelations as $fieldName => $manyRelation){
730
+        foreach ($manyRelations as $fieldName => $manyRelation) {
731 731
             $fields[$fieldName] = $manyRelation;
732 732
         }
733 733
         return $fields;
734 734
     }
735 735
 
736
-    public function getController($proxy = true){
736
+    public function getController($proxy = true) {
737 737
         $name = $this->getRecordClassName();
738 738
         $reflection = new ReflectionClass($name);
739 739
         $name = $reflection->getShortName();
740 740
         return $this->App()->Controller()->$name($proxy);
741 741
     }
742 742
 
743
-    public function getDisplayNameField(){
744
-        if($this->fieldExist("name")){
743
+    public function getDisplayNameField() {
744
+        if ($this->fieldExist("name")) {
745 745
             return $this->name;
746
-        }else{
746
+        } else {
747 747
             return $this->id;
748 748
         }
749 749
     }
750 750
 
751 751
     public function save(ORMRecord $record)
752 752
     {
753
-        if($this->usesWebIdTrait()){
754
-            if(empty($record->webId)){
753
+        if ($this->usesWebIdTrait()) {
754
+            if (empty($record->webId)) {
755 755
                 $record->initValue('webId', $this->webId());
756 756
             }
757 757
         }
@@ -760,8 +760,8 @@  discard block
 block discarded – undo
760 760
 
761 761
     public function get($mixedParam = null, $sPropertyName = null)
762 762
     {
763
-        if(!$mixedParam instanceof ORMCriteria){
764
-            if($this->usesWebIdTrait()){
763
+        if (!$mixedParam instanceof ORMCriteria) {
764
+            if ($this->usesWebIdTrait()) {
765 765
                 $mixedParam = $this->webId->is($mixedParam);
766 766
             }
767 767
         }
Please login to merge, or discard this patch.