Completed
Push — 7.x-1.x ( f0899f...94de83 )
by Benjamin
04:04
created
src/EcDataUtils.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -25,11 +25,9 @@  discard block
 block discarded – undo
25 25
   public static function getEcId($ec) {
26 26
     if (isset($ec->field_esd_ec_id['und']) && isset($ec->field_esd_ec_id['und'][0]) && isset($ec->field_esd_ec_id['und'][0]['value'])) {
27 27
       return $ec->field_esd_ec_id['und'][0]['value'];
28
-    }
29
-    elseif (gettype($ec->field_esd_ec_id) == 'string') {
28
+    } elseif (gettype($ec->field_esd_ec_id) == 'string') {
30 29
       return $ec->field_esd_ec_id;
31
-    }
32
-    else {
30
+    } else {
33 31
       return NULL;
34 32
     }
35 33
   }
@@ -132,8 +130,7 @@  discard block
 block discarded – undo
132 130
               $cloned_entity->{$url_field_name} = $url;
133 131
             }
134 132
           }
135
-        }
136
-        else {
133
+        } else {
137 134
           // Otherwise loop over the field and generate each URL.
138 135
           $cloned_entity->{$url_field_name} = array();
139 136
           foreach ($clone_wrapper->{$field_name}->getIterator() as $delta => $field_wrapper) {
@@ -170,15 +167,13 @@  discard block
 block discarded – undo
170 167
         if ($cloned_entity->{$field_name}) {
171 168
           $cloned_entity->{$field_name} = ['tid' => $term->tid, 'name' => $term->name];
172 169
         }
173
-      }
174
-      elseif ($clone_wrapper->{$field_name}->type() == 'list<taxonomy_term>') {
170
+      } elseif ($clone_wrapper->{$field_name}->type() == 'list<taxonomy_term>') {
175 171
         $new_val = [];
176 172
         foreach ($clone_wrapper->{$field_name}->value() as $term) {
177 173
           $new_val[] = ['tid' => $term->tid, 'name' => $term->name];
178 174
         }
179 175
         $cloned_entity->{$field_name} = $new_val;
180
-      }
181
-      elseif ($clone_wrapper->{$field_name}->type() == 'list<text>') {
176
+      } elseif ($clone_wrapper->{$field_name}->type() == 'list<text>') {
182 177
         $opts = $clone_wrapper->{$field_name}->optionsList();
183 178
         $newval = [];
184 179
         $iter = 0;
@@ -195,14 +190,12 @@  discard block
 block discarded – undo
195 190
 
196 191
         $cloned_entity->{$field_name} = $newval;
197 192
         unset($newval);
198
-      }
199
-      elseif ($clone_wrapper->{$field_name}->type() == 'text' && $clone_wrapper->{$field_name}->label()) {
193
+      } elseif ($clone_wrapper->{$field_name}->type() == 'text' && $clone_wrapper->{$field_name}->label()) {
200 194
         $cloned_entity->{$field_name} = [
201 195
           'machine_name' => $clone_wrapper->{$field_name}->value(),
202 196
           'label' => $clone_wrapper->{$field_name}->label(),
203 197
         ];
204
-      }
205
-      else {
198
+      } else {
206 199
         $cloned_entity->{$field_name} = $clone_wrapper->{$field_name}->raw();
207 200
       }
208 201
     }
@@ -304,8 +297,7 @@  discard block
 block discarded – undo
304 297
     // If a specific bundle's fields was requested, return just those.
305 298
     if (!empty($bundle)) {
306 299
       return $fields[$entity_type][$bundle];
307
-    }
308
-    else {
300
+    } else {
309 301
       // Otherwise combine all the fields for various bundles of the entity type
310 302
       // into a single return value.
311 303
       $combined_fields = array();
@@ -359,8 +351,7 @@  discard block
 block discarded – undo
359 351
 
360 352
       if (in_array($filter_field, array_keys($properties), TRUE)) {
361 353
         $query->propertyCondition($properties[$filter_field], $filter_value, $operator);
362
-      }
363
-      else {
354
+      } else {
364 355
         // Look for the field name among the entity type's field list.
365 356
         foreach (self::entityTypeFields($entity_type) as $field_name => $field_type) {
366 357
           // If the filter field begins with a field name, then either the
@@ -384,8 +375,7 @@  discard block
 block discarded – undo
384 375
               $column = key($field_info['columns']);
385 376
               $query->fieldCondition($field_name, $column, $filter_value, $operator);
386 377
               break;
387
-            }
388
-            else {
378
+            } else {
389 379
               // Otherwise if the filter field contains a valid column
390 380
               // specification for the field type, add the field condition to
391 381
               // the index query.
@@ -438,8 +428,7 @@  discard block
 block discarded – undo
438 428
 
439 429
       if (in_array($sort_field, array_keys($properties), TRUE)) {
440 430
         $query->propertyOrderBy($properties[$sort_field], $direction);
441
-      }
442
-      else {
431
+      } else {
443 432
         // Look for the field name among the entity type's field list.
444 433
         foreach (self::entityTypeFields($entity_type) as $field_name => $field_type) {
445 434
           // If the sort field begins with a field name, then either the sort
@@ -453,8 +442,7 @@  discard block
 block discarded – undo
453 442
               $column = key($field_info['columns']);
454 443
               $query->fieldOrderBy($field_name, $column, $direction);
455 444
               break;
456
-            }
457
-            else {
445
+            } else {
458 446
               // Otherwise if the sort field contains a valid column
459 447
               // specification for the field type, add the field condition to
460 448
               // the index query.
Please login to merge, or discard this patch.