src/Evispa/ObjectMigration/VersionConverter.php
public function migrateToClass($object, $otherVersionClassName) {
        $className = get_class($object);

        if ($className !== $this->className) {
            throw new \LogicException('Converter for class "' . $className . '" can not migrate "' . $className . '" objects.');
        }

        if ($className === $otherVersionClassName) {
            return $object;
        }

        if ($otherVersionClassName) {
            $versionPath = new VersionPathSearch($this->reader);
            $migrations = $versionPath->find($className, $otherVersionClassName);

            if (count($migrations) === 0) {
                throw new VersionPathNotFoundException($className, $otherVersionClassName);
            }

            foreach ($migrations as $migration) {
                $object = $migration->action->run($object, $this->options);
            }
        }

        return $object;
    }
public function migrateToClass($object, $otherVersionClassName) {
        $className = get_class($object);

        if ($className !== $this->className) {
            throw new \LogicException('Converter for class "' . $className . '" can not migrate "' . $className . '" objects.');
        }

        if ($className === $otherVersionClassName) {
            return $object;
        }

        if ($otherVersionClassName) {
            $versionPath = new VersionPathSearch($this->reader);
            $migrations = $versionPath->find($className, $otherVersionClassName);

            if (count($migrations) === 0) {
                throw new VersionPathNotFoundException($className, $otherVersionClassName);
            }

            foreach ($migrations as $migration) {
                $object = $migration->action->run($object, $this->options);
            }
        }

        return $object;
    }
Migrate object to specified version.

@param mixed  $object                    Object instance.
@param string $otherVersionClassName     Target class name.

@throws \LogicException
@throws Exception\VersionPathNotFoundException

@return mixed Migrated object.