Unverified Commit 71169689 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3087461 by labboy0276: Optimizations to the substr process plugin

parent 868feb2b
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
      throw new MigrateException('The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.');
    }
    $length = isset($this->configuration['length']) ? $this->configuration['length'] : NULL;
    if (!is_null($length) && !is_int($length)) {
    if ($length !== NULL && !is_int($length)) {
      throw new MigrateException('The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.');
    }
    if (!is_string($value)) {
@@ -83,8 +83,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
    }

    // Use optional start or length to return a portion of $value.
    $new_value = mb_substr($value, $start, $length);
    return $new_value;
    return mb_substr($value, $start, $length);
  }

}