Code Duplication    Length = 3-3 lines in 2 locations

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

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

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

@@ 483-485 (lines=3) @@
480
  public function entityCreate($entity_type, $entity) {
481
    // If the bundle field is empty, put the inferred bundle value in it.
482
    $bundle_key = \Drupal::entityManager()->getDefinition($entity_type)->getKey('bundle');
483
    if (!isset($entity->$bundle_key) && isset($entity->step_bundle)) {
484
      $entity->$bundle_key = $entity->step_bundle;
485
    }
486
487
    // Throw an exception if a bundle is specified but does not exist.
488
    if (isset($entity->$bundle_key) && ($entity->$bundle_key !== NULL)) {