configuration['postfix']) ? $this->configuration['postfix'] : ''; $start = isset($this->configuration['start']) ? $this->configuration['start'] : 0; if (!is_int($start)) { throw new MigrateException('The start position configuration key 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)) { throw new MigrateException('The character length configuration key should be an integer. Omit this key to capture the entire string.'); } // Use optional start or length to return a portion of the unique value. $value = Unicode::substr($value, $start, $length); $new_value = $value; while ($this->exists($new_value)) { $new_value = $value . $postfix . $i++; } return $new_value; } /** * This is a query checking the existence of some value. * * @param mixed $value * The value to check. * * @return bool * TRUE if the value exists. */ abstract protected function exists($value); }