Code Duplication    Length = 7-7 lines in 3 locations

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

@@ 352-358 (lines=7) @@
349
    }
350
351
    // If `parent` is set, look up a term in this vocab with that name.
352
    if (isset($term->parent)) {
353
      $parent = \taxonomy_get_term_by_name($term->parent);
354
      if (!empty($parent)) {
355
        $parent = reset($parent);
356
        $term->parent = $parent->tid;
357
      }
358
    }
359
360
    if (empty($term->vid)) {
361
      throw new \Exception(sprintf('No "%s" vocabulary found.'));

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

@@ 307-313 (lines=7) @@
304
    }
305
306
    // If `parent` is set, look up a term in this vocab with that name.
307
    if (isset($term->parent)) {
308
      $parent = \taxonomy_get_term_by_name($term->parent, $term->vocabulary_machine_name);
309
      if (!empty($parent)) {
310
        $parent = reset($parent);
311
        $term->parent = $parent->tid;
312
      }
313
    }
314
315
    if (empty($term->vid)) {
316
      throw new \Exception(sprintf('No "%s" vocabulary found.'));

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

@@ 331-337 (lines=7) @@
328
  public function termCreate(\stdClass $term) {
329
    $term->vid = $term->vocabulary_machine_name;
330
331
    if (isset($term->parent)) {
332
      $parent = \taxonomy_term_load_multiple_by_name($term->parent, $term->vocabulary_machine_name);
333
      if (!empty($parent)) {
334
        $parent = reset($parent);
335
        $term->parent = $parent->id();
336
      }
337
    }
338
339
    $this->expandEntityFields('taxonomy_term', $term);
340
    $entity = Term::create((array) $term);