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

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