Passed
Branchfeature/useWidgetsNamespaces (eb4650)
by Robin
02:57
created
programs/functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     if (null === $url) {
113 113
         $script = '<script type="text/javascript">';
114 114
         if (isset($message)) {
115
-            $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");';
115
+            $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");';
116 116
         }
117 117
         $script .= 'history.back();';
118 118
         $script .= '</script>';
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $url = $url->url();
125 125
     }
126 126
     if (!empty($babBody->msgerror)) {
127
-        $url .=  '&msgerror=' . urlencode($babBody->msgerror);
127
+        $url .= '&msgerror='.urlencode($babBody->msgerror);
128 128
     }
129 129
     if (isset($message)) {
130 130
         $lines = explode("\n", $message);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
     }
135 135
 
136
-    header('Location: ' . $url);
136
+    header('Location: '.$url);
137 137
     die;
138 138
 }
139 139
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
  */
166 166
 function app_fileUploadError($error)
167 167
 {
168
-    switch($error) {
168
+    switch ($error) {
169 169
         case UPLOAD_ERR_OK:
170 170
             return null;
171 171
 
Please login to merge, or discard this patch.
programs/define.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
  * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-define('APP_PHP_PATH', dirname(__FILE__) . '/');
25
-define('APP_SET_PATH', dirname(__FILE__) . '/');
26
-define('APP_UI_PATH', dirname(__FILE__) . '/ui/');
27
-define('APP_WIDGETS_PATH', APP_UI_PATH . 'widgets/');
28
-define('APP_CTRL_PATH', dirname(__FILE__) . '/');
29
-define('APP_PORTLET_PATH', APP_PHP_PATH . 'portlet/');
30 24
\ No newline at end of file
25
+define('APP_PHP_PATH', dirname(__FILE__).'/');
26
+define('APP_SET_PATH', dirname(__FILE__).'/');
27
+define('APP_UI_PATH', dirname(__FILE__).'/ui/');
28
+define('APP_WIDGETS_PATH', APP_UI_PATH.'widgets/');
29
+define('APP_CTRL_PATH', dirname(__FILE__).'/');
30
+define('APP_PORTLET_PATH', APP_PHP_PATH.'portlet/');
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
programs/Set/AppCustomSectionSet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,9 +109,9 @@
 block discarded – undo
109 109
     public function isUpdatable()
110 110
     {
111 111
         return $this->all();
112
-        if($this->App()
112
+        if ($this->App()
113 113
             ->Access()
114
-            ->administer()){
114
+            ->administer()) {
115 115
             return $this->all();
116 116
         }
117 117
         return $this->none();
Please login to merge, or discard this patch.
programs/Set/AppCustomSection.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $App = app_App();
64 64
         static $fieldsLayouts = null;
65 65
         
66
-        if(! isset($fieldsLayouts)){
66
+        if (!isset($fieldsLayouts)) {
67 67
             $fieldsLayouts = array(
68 68
                 self::FIELDS_LAYOUT_VERTICAL_LABEL => $App->translate('Vertical label'),
69 69
                 self::FIELDS_LAYOUT_HORIZONTAL_LABEL => $App->translate('Horizontal label'),
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getRawFields()
82 82
     {
83
-        if(empty($this->fields)){
83
+        if (empty($this->fields)) {
84 84
             return array();
85 85
         }
86 86
         return explode(',', $this->fields);
@@ -105,29 +105,29 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function getFields()
107 107
     {
108
-        if(empty($this->fields)){
108
+        if (empty($this->fields)) {
109 109
             return array();
110 110
         }
111 111
         $fields = json_decode($this->fields, true);
112
-        if(json_last_error() === JSON_ERROR_NONE){
112
+        if (json_last_error() === JSON_ERROR_NONE) {
113 113
             return $fields;
114 114
         }
115 115
         
116 116
         $fields = array();
117 117
         $rawFields = $this->getRawFields();
118
-        foreach ($rawFields as $rawField){
119
-            if(empty($rawField)){
118
+        foreach ($rawFields as $rawField) {
119
+            if (empty($rawField)) {
120 120
                 continue;
121 121
             }
122 122
             $params = array();
123 123
             
124
-            if(strpos($rawField, ':') === false){
124
+            if (strpos($rawField, ':') === false) {
125 125
                 $fieldName = $rawField;
126 126
             }
127
-            else{
127
+            else {
128 128
                 list ($fieldName, $parameters) = explode(':', $rawField);
129 129
                 $parameters = explode(';', $parameters);
130
-                foreach ($parameters as $parameter){
130
+                foreach ($parameters as $parameter) {
131 131
                     list ($key, $value) = explode('=', $parameter);
132 132
                     $params[$key] = $value;
133 133
                 }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function getField($searchedFieldName)
162 162
     {
163
-        if(empty($this->fields)){
163
+        if (empty($this->fields)) {
164 164
             return null;
165 165
         }
166 166
         
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     public function addField($fieldName, $parameters = null)
178 178
     {
179 179
         $fields = $this->getFields();
180
-        if(! isset($parameters)){
180
+        if (!isset($parameters)) {
181 181
             $fields[$fieldName] = array(
182 182
                 'block' => ''
183 183
             );
@@ -211,24 +211,24 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $isFieldsGroup = false;
213 213
         $fields = $this->getFields();
214
-        if(strpos($updatedFieldName, '_fieldsGroup') !== false){
214
+        if (strpos($updatedFieldName, '_fieldsGroup') !== false) {
215 215
             $isFieldsGroup = true;
216 216
             list (, $groupPos) = explode('_fieldsGroup', $updatedFieldName);
217
-            if(! isset($groupPos) || empty($groupPos)){
217
+            if (!isset($groupPos) || empty($groupPos)) {
218 218
                 $groupPos = 0;
219 219
             }
220 220
         }
221
-        if(! isset($fields[$updatedFieldName])){
222
-            if($isFieldsGroup){
223
-                while (isset($fields[$updatedFieldName . $groupPos])){
224
-                    $groupPos ++;
221
+        if (!isset($fields[$updatedFieldName])) {
222
+            if ($isFieldsGroup) {
223
+                while (isset($fields[$updatedFieldName.$groupPos])) {
224
+                    $groupPos++;
225 225
                 }
226 226
                 $updatedFieldName .= $groupPos;
227 227
             }
228 228
             $this->addField($updatedFieldName, $parameters);
229 229
             return $this;
230 230
         }
231
-        if(! isset($parameters)){
231
+        if (!isset($parameters)) {
232 232
             $fields[$updatedFieldName] = array(
233 233
                 'block' => ''
234 234
             );
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
     public function addFieldToGroup($fieldGroupName, $fieldName, $parameters = null)
244 244
     {
245 245
         $fields = $this->getFields();
246
-        if(! isset($fields[$fieldGroupName])){
246
+        if (!isset($fields[$fieldGroupName])) {
247 247
             return $this;
248 248
         }
249 249
         $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array();
250
-        if(! isset($parameters)){
250
+        if (!isset($parameters)) {
251 251
             $groupFields[$fieldName] = array(
252 252
                 'block' => ''
253 253
             );
@@ -281,15 +281,15 @@  discard block
 block discarded – undo
281 281
     public function updateFieldGroup($fieldGroupName, $updatedFieldName, $parameters = null)
282 282
     {
283 283
         $fields = $this->getFields();
284
-        if(! isset($fields[$fieldGroupName])){
284
+        if (!isset($fields[$fieldGroupName])) {
285 285
             return $this;
286 286
         }
287 287
         $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array();
288
-        if(! isset($groupFields[$updatedFieldName])){
288
+        if (!isset($groupFields[$updatedFieldName])) {
289 289
             $this->addFieldToGroup($fieldGroupName, $updatedFieldName, $parameters);
290 290
             return $this;
291 291
         }
292
-        if(! isset($parameters)){
292
+        if (!isset($parameters)) {
293 293
             $groupFields[$updatedFieldName] = array(
294 294
                 'block' => ''
295 295
             );
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function isVisibleForRecord(AppRecord $record)
311 311
     {
312
-        if(empty($this->visibilityCriteria)){
312
+        if (empty($this->visibilityCriteria)) {
313 313
             return true;
314 314
         }
315 315
         
@@ -318,36 +318,36 @@  discard block
 block discarded – undo
318 318
         
319 319
         $arrCriteria = json_decode($this->visibilityCriteria, true);
320 320
         
321
-        foreach ($arrCriteria as $fieldName => $condition){
322
-            if(strpos($fieldName, '/') !== false){
321
+        foreach ($arrCriteria as $fieldName => $condition) {
322
+            if (strpos($fieldName, '/') !== false) {
323 323
                 list ($oneField, $foreignField) = explode('/', $fieldName);
324 324
                 $field = $recordSet->$oneField()->$foreignField;
325 325
             }
326
-            else{
326
+            else {
327 327
                 $field = $recordSet->$fieldName;
328 328
             }
329
-            foreach ($condition as $op => $value){
330
-                if(! is_array($value)){
329
+            foreach ($condition as $op => $value) {
330
+                if (!is_array($value)) {
331 331
                     $criteria = $field->$op($value);
332 332
                 }
333
-                else{
334
-                    foreach ($value as $foreignClassName => $foreignValues){
335
-                        $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set';
333
+                else {
334
+                    foreach ($value as $foreignClassName => $foreignValues) {
335
+                        $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set';
336 336
                         $foreignSet = $App->$foreignClassName();
337 337
                         $foreignField = '';
338 338
                         $foreignCondition = '';
339
-                        foreach ($foreignValues as $foreignFieldName => $foreignConditions){
340
-                            if($foreignFieldName === '_foreignField'){
339
+                        foreach ($foreignValues as $foreignFieldName => $foreignConditions) {
340
+                            if ($foreignFieldName === '_foreignField') {
341 341
                                 $foreignField = $foreignConditions;
342 342
                             }
343
-                            else{
344
-                                foreach ($foreignConditions as $key => $val){
343
+                            else {
344
+                                foreach ($foreignConditions as $key => $val) {
345 345
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
346 346
                                 }
347 347
                             }
348 348
                         }
349 349
                     }
350
-                    if(method_exists($foreignSet, 'getDefaultCriteria')){
350
+                    if (method_exists($foreignSet, 'getDefaultCriteria')) {
351 351
                         $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria());
352 352
                     }
353 353
                     $criteria = $field->in($foreignCondition, $foreignField);
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -123,8 +123,7 @@  discard block
 block discarded – undo
123 123
             
124 124
             if(strpos($rawField, ':') === false){
125 125
                 $fieldName = $rawField;
126
-            }
127
-            else{
126
+            } else{
128 127
                 list ($fieldName, $parameters) = explode(':', $rawField);
129 128
                 $parameters = explode(';', $parameters);
130 129
                 foreach ($parameters as $parameter){
@@ -322,15 +321,13 @@  discard block
 block discarded – undo
322 321
             if(strpos($fieldName, '/') !== false){
323 322
                 list ($oneField, $foreignField) = explode('/', $fieldName);
324 323
                 $field = $recordSet->$oneField()->$foreignField;
325
-            }
326
-            else{
324
+            } else{
327 325
                 $field = $recordSet->$fieldName;
328 326
             }
329 327
             foreach ($condition as $op => $value){
330 328
                 if(! is_array($value)){
331 329
                     $criteria = $field->$op($value);
332
-                }
333
-                else{
330
+                } else{
334 331
                     foreach ($value as $foreignClassName => $foreignValues){
335 332
                         $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set';
336 333
                         $foreignSet = $App->$foreignClassName();
@@ -339,8 +336,7 @@  discard block
 block discarded – undo
339 336
                         foreach ($foreignValues as $foreignFieldName => $foreignConditions){
340 337
                             if($foreignFieldName === '_foreignField'){
341 338
                                 $foreignField = $foreignConditions;
342
-                            }
343
-                            else{
339
+                            } else{
344 340
                                 foreach ($foreignConditions as $key => $val){
345 341
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
346 342
                                 }
Please login to merge, or discard this patch.
programs/Set/AppSSESet.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     
61 61
     public function selectUserSSE($user = null)
62 62
     {
63
-        if(!isset($user)){
63
+        if (!isset($user)) {
64 64
             $App = $this->App();
65 65
             $user = $App->getCurrentUser();
66 66
         }
@@ -82,29 +82,29 @@  discard block
 block discarded – undo
82 82
         $userSSEReloads = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_RELOAD_SELECTOR)));
83 83
         $reloadSelectors = array();
84 84
         $now = date('Y-m-d H:i:s');
85
-        foreach ($userSSEReloads as $sseMsg){
85
+        foreach ($userSSEReloads as $sseMsg) {
86 86
             $reloadSelectors[] = $sseMsg->data;
87
-            if($delete && $now > date($sseMsg->deleteOn)){
87
+            if ($delete && $now > date($sseMsg->deleteOn)) {
88 88
                 $sseMsg->delete();
89 89
             }
90 90
         }
91 91
         
92
-        if(!empty($reloadSelectors)){
92
+        if (!empty($reloadSelectors)) {
93 93
             $sseData .= '"reloadSelector":'.bab_json_encode($reloadSelectors);
94 94
             $hasData = true;
95 95
         }
96 96
         
97 97
         $userSSEBrowserNotifications = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_BROWSER_NOTIFICATION)));
98 98
         $browserNotifications = array();
99
-        foreach ($userSSEBrowserNotifications as $sseMsg){
99
+        foreach ($userSSEBrowserNotifications as $sseMsg) {
100 100
             $browserNotifications[] = $sseMsg->data;
101
-            if($delete){
101
+            if ($delete) {
102 102
                 $sseMsg->delete();
103 103
             }
104 104
         }
105 105
         
106
-        if(!empty($browserNotifications)){
107
-            if($hasData){
106
+        if (!empty($browserNotifications)) {
107
+            if ($hasData) {
108 108
                 $sseData .= ', ';
109 109
             }
110 110
             $sseData .= '"browserNotifications":'.bab_json_encode($browserNotifications);
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $App = $this->App();
127 127
         $users = array();
128
-        if(!isset($for)){
128
+        if (!isset($for)) {
129 129
             $users[] = $App->getCurrentUser();
130 130
         }
131
-        else if(!is_array($for)){
132
-            if($for === 'all'){
131
+        else if (!is_array($for)) {
132
+            if ($for === 'all') {
133 133
                 $users = $App->getLoggedUsers();
134 134
             }
135
-            else{
135
+            else {
136 136
                 $users[] = $for;
137 137
             }
138 138
         }
139 139
         
140 140
         $deleteOn = self::getDeleteOn();
141
-        foreach ($users as $user){
141
+        foreach ($users as $user) {
142 142
             $record = $this->newRecord();
143 143
             $record->user = $user;
144 144
             $record->data = $reloadSelector;
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $App = $this->App();
166 166
         $users = array();
167
-        if(!isset($for)){
167
+        if (!isset($for)) {
168 168
             $users[] = $App->getCurrentUser();
169 169
         }
170
-        else if(!is_array($for)){
171
-            if($for === 'all'){
170
+        else if (!is_array($for)) {
171
+            if ($for === 'all') {
172 172
                 $users = $App->getLoggedUsers();
173 173
             }
174
-            else{
174
+            else {
175 175
                 $users[] = $for;
176 176
             }
177 177
         }
178 178
         
179 179
         $deleteOn = self::getDeleteOn();
180
-        foreach ($users as $user){
180
+        foreach ($users as $user) {
181 181
             $record = $this->newRecord();
182 182
             $record->user = $user;
183 183
             $record->data = bab_json_encode($data);
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -127,12 +127,10 @@  discard block
 block discarded – undo
127 127
         $users = array();
128 128
         if(!isset($for)){
129 129
             $users[] = $App->getCurrentUser();
130
-        }
131
-        else if(!is_array($for)){
130
+        } else if(!is_array($for)){
132 131
             if($for === 'all'){
133 132
                 $users = $App->getLoggedUsers();
134
-            }
135
-            else{
133
+            } else{
136 134
                 $users[] = $for;
137 135
             }
138 136
         }
@@ -166,12 +164,10 @@  discard block
 block discarded – undo
166 164
         $users = array();
167 165
         if(!isset($for)){
168 166
             $users[] = $App->getCurrentUser();
169
-        }
170
-        else if(!is_array($for)){
167
+        } else if(!is_array($for)){
171 168
             if($for === 'all'){
172 169
                 $users = $App->getLoggedUsers();
173
-            }
174
-            else{
170
+            } else{
175 171
                 $users[] = $for;
176 172
             }
177 173
         }
Please login to merge, or discard this patch.
programs/Set/AppRecord.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -351,8 +351,7 @@  discard block
 block discarded – undo
351 351
         if(isset($linkType)){
352 352
             if(is_array($linkType)){
353 353
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
354
-            }
355
-            else{
354
+            } else{
356 355
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
357 356
             }
358 357
         }
@@ -379,8 +378,7 @@  discard block
 block discarded – undo
379 378
         if(isset($linkType)){
380 379
             if(is_array($linkType)){
381 380
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
382
-            }
383
-            else{
381
+            } else{
384 382
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
385 383
             }
386 384
         }
Please login to merge, or discard this 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/AppLink.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function getSource()
46 46
     {
47 47
         $App = $this->App();
48
-        return $App->getRecordByRef($this->sourceClass . ':' . $this->sourceId);
48
+        return $App->getRecordByRef($this->sourceClass.':'.$this->sourceId);
49 49
     }
50 50
     
51 51
     /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function getTarget()
55 55
     {
56 56
         $App = $this->App();
57
-        return $App->getRecordByRef($this->targetClass . ':' . $this->targetId);
57
+        return $App->getRecordByRef($this->targetClass.':'.$this->targetId);
58 58
     }
59 59
 }
60 60
 
Please login to merge, or discard this patch.
programs/Set/AppNotificationSet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     
66 66
     public function selectUserNotifications($user = null, $seen = false)
67 67
     {
68
-        if(! isset($user)){
68
+        if (!isset($user)) {
69 69
             $App = $this->App();
70 70
             $user = $App->getCurrentUser();
71 71
         }
Please login to merge, or discard this patch.
programs/Set/AppLinkSet.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function joinSource($sourceClass)
104 104
     {
105
-        if(! $this->sourceId instanceof $sourceClass){
106
-            $this->hasOne('sourceId', $sourceClass . 'Set');
105
+        if (!$this->sourceId instanceof $sourceClass) {
106
+            $this->hasOne('sourceId', $sourceClass.'Set');
107 107
             $this->join('sourceId');
108 108
         }
109 109
     }
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function joinTarget($targetClass = null)
115 115
     {
116
-        if(! $this->targetId instanceof $targetClass){
117
-            $this->hasOne('targetId', $targetClass . 'Set');
116
+        if (!$this->targetId instanceof $targetClass) {
117
+            $this->hasOne('targetId', $targetClass.'Set');
118 118
             $this->join('targetId');
119 119
         }
120 120
     }
@@ -162,21 +162,21 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $criteria = $this->sourceIs($object);
164 164
         
165
-        if(isset($targetClass)){
165
+        if (isset($targetClass)) {
166 166
             $this->joinTarget($targetClass);
167 167
             $criteria = $criteria->_AND_($this->targetClass->is($targetClass));
168 168
         }
169 169
         
170
-        if(isset($linkType)){
171
-            if(is_array($linkType)){
170
+        if (isset($linkType)) {
171
+            if (is_array($linkType)) {
172 172
                 $criteria = $criteria->_AND_($this->type->in($linkType));
173 173
             }
174
-            else{
174
+            else {
175 175
                 $criteria = $criteria->_AND_($this->type->is($linkType));
176 176
             }
177 177
         }
178 178
         
179
-        if(is_a($this->targetId, 'app_TraceableRecordSet')){
179
+        if (is_a($this->targetId, 'app_TraceableRecordSet')) {
180 180
             $criteria = $criteria->_AND_($this->targetId->deleted->is(false));
181 181
         }
182 182
         
@@ -191,24 +191,24 @@  discard block
 block discarded – undo
191 191
         $sourceClass = null;
192 192
         $sourceIds = array();
193 193
         
194
-        foreach ($objects as $obj){
195
-            if(is_null($sourceClass)){
194
+        foreach ($objects as $obj) {
195
+            if (is_null($sourceClass)) {
196 196
                 $sourceClass = $obj->getClassName();
197 197
             }
198 198
             $sourceIds[] = $obj->id;
199 199
         }
200 200
         $criteria = $this->sourceId->in($sourceIds)->_AND_($this->sourceClass->is($sourceClass));
201 201
         
202
-        if(isset($targetClass)){
202
+        if (isset($targetClass)) {
203 203
             $this->joinTarget($targetClass);
204 204
             $criteria = $criteria->_AND_($this->targetClass->is($targetClass));
205 205
         }
206 206
         
207
-        if(isset($linkType)){
208
-            if(is_array($linkType)){
207
+        if (isset($linkType)) {
208
+            if (is_array($linkType)) {
209 209
                 $criteria = $criteria->_AND_($this->type->in($linkType));
210 210
             }
211
-            else{
211
+            else {
212 212
                 $criteria = $criteria->_AND_($this->type->is($linkType));
213 213
             }
214 214
         }
@@ -222,16 +222,16 @@  discard block
 block discarded – undo
222 222
     {
223 223
         $criteria = $this->targetIs($object);
224 224
         
225
-        if(isset($sourceClass)){
225
+        if (isset($sourceClass)) {
226 226
             $this->joinSource($sourceClass);
227 227
             $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));
228 228
         }
229 229
         
230
-        if(isset($linkType)){
231
-            if(is_array($linkType)){
230
+        if (isset($linkType)) {
231
+            if (is_array($linkType)) {
232 232
                 $criteria = $criteria->_AND_($this->type->in($linkType));
233 233
             }
234
-            else{
234
+            else {
235 235
                 $criteria = $criteria->_AND_($this->type->is($linkType));
236 236
             }
237 237
         }
@@ -247,24 +247,24 @@  discard block
 block discarded – undo
247 247
         $targetClass = null;
248 248
         $targetIds = array();
249 249
         
250
-        foreach ($objects as $obj){
251
-            if(is_null($targetClass)){
250
+        foreach ($objects as $obj) {
251
+            if (is_null($targetClass)) {
252 252
                 $targetClass = $obj->getClassName();
253 253
             }
254 254
             $targetIds[] = $obj->id;
255 255
         }
256 256
         $criteria = $this->targetId->in($targetIds)->_AND_($this->targetClass->is($targetClass));
257 257
         
258
-        if(isset($sourceClass)){
258
+        if (isset($sourceClass)) {
259 259
             $this->joinSource($sourceClass);
260 260
             $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));
261 261
         }
262 262
         
263
-        if(isset($linkType)){
264
-            if(is_array($linkType)){
263
+        if (isset($linkType)) {
264
+            if (is_array($linkType)) {
265 265
                 $criteria = $criteria->_AND_($this->type->in($linkType));
266 266
             }
267
-            else{
267
+            else {
268 268
                 $criteria = $criteria->_AND_($this->type->is($linkType));
269 269
             }
270 270
         }
@@ -288,17 +288,17 @@  discard block
 block discarded – undo
288 288
         
289 289
         $criteria = $set->sourceId->is($object->id)->_AND_($set->sourceClass->is($object->getClassName()));
290 290
         
291
-        if(null !== $targetClass){
291
+        if (null !== $targetClass) {
292 292
             $criteria = $criteria->_AND_($set->targetClass->is($targetClass));
293 293
         }
294
-        if(null !== $linkType){
294
+        if (null !== $linkType) {
295 295
             $criteria = $criteria->_AND_($set->type->is($linkType));
296 296
         }
297 297
         
298
-        if($deleteTarget){
299
-            foreach ($set->select($criteria) as $link){
298
+        if ($deleteTarget) {
299
+            foreach ($set->select($criteria) as $link) {
300 300
                 
301
-                $className = $link->targetClass . 'Set';
301
+                $className = $link->targetClass.'Set';
302 302
                 
303 303
                 // remove prefix
304 304
                 
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
             ->_AND_($this->sourceClass->is($source->getClassName()))
327 327
             ->_AND_($this->targetId->is($target->id))
328 328
             ->_AND_($this->targetClass->is($target->getClassName()));
329
-        if(isset($linkType)){
330
-            if(is_array($linkType)){
329
+        if (isset($linkType)) {
330
+            if (is_array($linkType)) {
331 331
                 $criteria = $criteria->_AND_($this->type->in($linkType));
332 332
             }
333
-            else{
333
+            else {
334 334
                 $criteria = $criteria->_AND_($this->type->is($linkType));
335 335
             }
336 336
         }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -170,8 +170,7 @@  discard block
 block discarded – undo
170 170
         if(isset($linkType)){
171 171
             if(is_array($linkType)){
172 172
                 $criteria = $criteria->_AND_($this->type->in($linkType));
173
-            }
174
-            else{
173
+            } else{
175 174
                 $criteria = $criteria->_AND_($this->type->is($linkType));
176 175
             }
177 176
         }
@@ -207,8 +206,7 @@  discard block
 block discarded – undo
207 206
         if(isset($linkType)){
208 207
             if(is_array($linkType)){
209 208
                 $criteria = $criteria->_AND_($this->type->in($linkType));
210
-            }
211
-            else{
209
+            } else{
212 210
                 $criteria = $criteria->_AND_($this->type->is($linkType));
213 211
             }
214 212
         }
@@ -230,8 +228,7 @@  discard block
 block discarded – undo
230 228
         if(isset($linkType)){
231 229
             if(is_array($linkType)){
232 230
                 $criteria = $criteria->_AND_($this->type->in($linkType));
233
-            }
234
-            else{
231
+            } else{
235 232
                 $criteria = $criteria->_AND_($this->type->is($linkType));
236 233
             }
237 234
         }
@@ -263,8 +260,7 @@  discard block
 block discarded – undo
263 260
         if(isset($linkType)){
264 261
             if(is_array($linkType)){
265 262
                 $criteria = $criteria->_AND_($this->type->in($linkType));
266
-            }
267
-            else{
263
+            } else{
268 264
                 $criteria = $criteria->_AND_($this->type->is($linkType));
269 265
             }
270 266
         }
@@ -329,8 +325,7 @@  discard block
 block discarded – undo
329 325
         if(isset($linkType)){
330 326
             if(is_array($linkType)){
331 327
                 $criteria = $criteria->_AND_($this->type->in($linkType));
332
-            }
333
-            else{
328
+            } else{
334 329
                 $criteria = $criteria->_AND_($this->type->is($linkType));
335 330
             }
336 331
         }
Please login to merge, or discard this patch.