@param string|null $name
@param string|null $version

@return bool
188886
public function set($name = null, $version = null)
    {
        if ($name !== null) {
            $this->name = trim($name);
        }

        if ($version !== null) {
            $this->version = trim($version);
        }

        return true;
    }
18648
private function execute($version = null, $message = null, $up = true)
    {
        $files = $this->migrationFiles->get($version, $up);
        if (null === $files) {
            return 0;
        }
        $this->schemaManipulation->execute('BEGIN');
        try {
            foreach ($files as $file) {

                require_once $file->getPath();

                $definition = $this->createMigrationApiInstance($file->getClassName());

                if ($message) {
                    $message($file->getName(), $file->getVersion());
                }
                if ($up) {
                    $definition->up();
                } else {
                    $definition->down();
                }
                foreach ($definition->getActions() as $action) {
                    if (!is_callable($action)) {
                        throw new \InvalidArgumentException('Migration must be callable');
                    }
                    $action = call_user_func_array($action, array());
                    if ($action instanceof MigrationApi) {
                        $action->execute();
                    }
                }
                $this->schemaTable->migrateToVersion($file->getVersion(), $up);
            }
            $this->schemaManipulation->execute('COMMIT');
        } catch (\Exception $e) {
            $this->schemaManipulation->execute('ROLLBACK');
            throw $e;
        }

        return count($files);
    }
410761
public static function isMatch($constraint, Version $version, &$failures = array())
    {
        foreach (explode(',', $constraint) as $constraintExpression) {
            $c = self::fromString($constraintExpression);
            if (!$c->match($version)) {
                $failures[]= "Constraint '$constraintExpression' failed";
            }
        }
        return count($failures) === 0;
    }
757667
protected function mustTilde(Version $version)
    {
        if (is_null($version->getPath()))
        {
            if (is_null($version->getMinor()))
            {
                if ($version->getFloatMajor() > $this->getFloatMajor())
                    return false;
            }

            else //Minor not null
            {
                if ($version->getFloatMinor() > $this->getFloatMinor())
                    return false;

                if ($version->getFloatMajor() != $this->getFloatMajor())
                    return false;
            }
        }
        else //Path not null
        {
            if ($version->getFloatPath() > $this->getFloatPath())
                return false;

            if ($version->getFloatMinor() != $this->getFloatMinor())
                return false;

            if ($version->getFloatMajor() != $this->getFloatMajor())
                return false;
        }

        return true;
    }
1278369
public static function isValid ($version)
    {
        if (self::isDev($version)) {
            return true;
        } else {
            return (boolean) preg_match('/' . self::$validPattern . '/i', $version);
        }
    }
1111747
public function setVersion($version, $id = false)
    {
        if ($id === false) {
            $id = $this->getMainBlock()->getId();
        }

        $this->versionMap[$id] = $version;
    }
200984
public function setVersion($version)
    {
        if (null !== $version) {
            Assert::string($version, 'The application version must be a string. Got: %s');
            Assert::notEmpty($version, 'The application version must not be empty.');
        }

        $this->version = $version;

        return $this;
    }
1102762
public function setVersion($version)
    {

        if (!is_null($version) && (!preg_match("/^(([0-9]|[1-9][0-9]*)\\.([0-9]|[1-9][0-9]*)\\.([0-9]|[1-9][0-9]*)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?)?$/", $version))) {
            throw new \InvalidArgumentException("invalid value for $version when calling Stack., must conform to the pattern /^(([0-9]|[1-9][0-9]*)\\.([0-9]|[1-9][0-9]*)\\.([0-9]|[1-9][0-9]*)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?)?$/.");
        }

        $this->container['version'] = $version;

        return $this;
    }
630890
private static function generateVersion($namespace, $name, $version)
    {
        if (!self::isValid($namespace)) {
            return false;
        }

        $nhex = str_replace(array('-', '{', '}'), '', $namespace);
        $nstr = '';
        $len = strlen($nhex);

        for ($i = 0; $i < $len; $i += 2) {
            $nstr .= chr(hexdec($nhex[$i].$nhex[$i + 1]));
        }

        if ($version == 3) {
            $hash = md5($nstr.$name);
            $digit = 0x3000;
        } else {
            $hash = sha1($nstr.$name);
            $digit = 0x5000;
        }

        return sprintf('%08s-%04s-%04x-%04x-%12s',
            substr($hash, 0, 8),
            substr($hash, 8, 4),
            (hexdec(substr($hash, 12, 4)) & 0x0fff) | $digit,
            (hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
            substr($hash, 20, 12)
        );
    }
1188409
public static function fromString(string $version)
    {
        $version = trim($version);

        /*
         * No version provided?
         * Nothing to do
         */
        if (empty($version)) {
            return null;
        }

        $matches = [];
        $pattern = '/^(\d+)\.(\d+)\.(\d+)$/'; // e.g. "1.0.2"
        $matched = preg_match($pattern, $version, $matches);

        /*
         * Incorrect version?
         * Nothing to do
         */
        if (0 === $matched || false === $matched) {
            return null;
        }

        $majorPart = (int)$matches[1];
        $minorPart = (int)$matches[2];
        $patchPart = (int)$matches[3];

        return new static($majorPart, $minorPart, $patchPart);
    }
474558
protected function isVersionIsGreaterOrEqual($version, $other) {
    $max = min(count($version), count($other));
    for ($i = 0; $i < $max; $i++) {
      if ($version[$i] < $other[$i]) {
        return false;
      }
    }
    return true;
  }
1141752
protected function doSkip($name, $normalizedVersion)
    {
        if (!isset($this->requires[$name]) || false !== strpos($normalizedVersion, '-p')) {
            return false;
        }

        /** @var Link $require */
        $require = $this->requires[$name];

        return !$this->satisfy($require, $normalizedVersion) && $this->isEnabled();
    }
611549
public function installPackage(string $name, string $version, bool $dev = true)
    {
        $node = $dev ? 'require-dev' : 'require';

        if (array_key_exists($node, $this->definition)
            && array_key_exists($name, $this->definition[$node])
        ) {
            return;
        }

        $application = new Application();
        $command     = new RequireCommand();

        $definition = clone $application->getDefinition();
        $definition->addArguments($command->getDefinition()->getArguments());
        $definition->addOptions($command->getDefinition()->getOptions());

        $input = new ArrayInput(
            [
                'command' => 'require',
                'packages' => [$name . ':' . $version],
                '--dev' => $dev,
                '--no-scripts' => true,
                '--no-interaction' => true,
                '--no-plugins' => true,
                '--working-dir' => $this->workingDir
            ],
            $definition
        );

        $application->setAutoExit(false);
        $application->run($input, $this->output);
    }
1024895
public function migrate($environment, $version = NULL)
	{
		foreach ($this->migrationConfigurations as $migrationConfiguration) {
			$this->getPhinxManager()->setConfig($migrationConfiguration);
			$this->getPhinxManager()->migrate($environment, $version);
		}
	}
76651
public function get($version = null, $up = true)
    {
        $currentVersion = $this->schemaTable->getCurrentVersion();
        if (null !== $version && false === $up && (int) $version > (int) $currentVersion) {
            return null;
        }

        $files = $this->getFiles($up);

        if (!$this->fileVersionExists($version, $this->getFiles($up))) {
            return null;
        }

        $migrationFiles = array();
        foreach ($files as $file) {
            $filenameParser = new FileNameParser($file->getFileName());
            $isMigrated = in_array($filenameParser->getVersion(), $this->schemaTable->getVersions());
            $migrationFile = new MigrationFile($filenameParser->getMigrationName(), $file->getRealpath(),
                $filenameParser->getVersion(), $filenameParser->getMigrationClassName(), $isMigrated);

            if (false === $this->statusIntention) {
                if ($up && $isMigrated || !$up && !$isMigrated) {
                    continue;
                }
                if ($version == $migrationFile->getVersion()) {
                    $migrationFiles[] = $migrationFile;
                    break;
                }
            }
            $migrationFiles[] = $migrationFile;
        }

        return $migrationFiles;
    }
480957
public function supportsVersion(Version $version) : bool
    {
        try {
            $this->getVersionUrl($version);
        } catch (UnsupportedVersionException $e) {
            return false;
        }

        return true;
    }
332026
final public function transaction(?string $version = null): Contracts\Bill\Transaction
    {
        return $this->uses('Bill.Transaction', $version);
    }