Code Duplication    Length = 3-3 lines in 2 locations

src/Drupal/Driver/Cores/Drupal8.php 1 location

@@ 498-500 (lines=3) @@
495
  public function entityCreate($entity_type, $entity) {
496
    // If the bundle field is empty, put the inferred bundle value in it.
497
    $bundle_key = \Drupal::entityTypeManager()->getDefinition($entity_type)->getKey('bundle');
498
    if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) {
499
      $entity->$bundle_key = $entity->step_bundle;
500
    }
501
502
    // Throw an exception if a bundle is specified but does not exist.
503
    if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) {

src/Drupal/Driver/Cores/Drupal7.php 1 location

@@ 494-496 (lines=3) @@
491
    $info = entity_get_info($entity_type);
492
    // If the bundle field is empty, put the inferred bundle value in it.
493
    $bundle_key = $info['entity keys']['bundle'];
494
    if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) {
495
      $entity->$bundle_key = $entity->step_bundle;
496
    }
497
498
    // Throw an exception if a bundle is specified but does not exist.
499
    if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) {