src/lib/KevinGH/Version/Version.php
protected function parseString($string)
    {
        $this->build = null;
        $this->major = 0;
        $this->minor = 0;
        $this->patch = 0;
        $this->pre = null;

        if (false === static::isValid($string)) {
            throw new InvalidArgumentException(sprintf('The version string "%s" is invalid.', $string));
        }

        if (false !== strpos($string, '+')) {
            list($string, $build) = explode('+', $string);

            $this->setBuild(explode('.', $build));
        }

        if (false !== strpos($string, '-')) {
            list($string, $pre) = explode('-', $string);

            $this->setPreRelease(explode('.', $pre));
        }

        $version = explode('.', $string);

        $this->major = (int)$version[0];

        if (isset($version[1])) {
            $this->minor = (int)$version[1];
        }

        if (isset($version[2])) {
            $this->patch = (int)$version[2];
        }
    }
protected function parseString($string)
    {
        $this->build = null;
        $this->major = 0;
        $this->minor = 0;
        $this->patch = 0;
        $this->pre = null;

        if (false === static::isValid($string)) {
            throw new InvalidArgumentException(sprintf('The version string "%s" is invalid.', $string));
        }

        if (false !== strpos($string, '+')) {
            list($string, $build) = explode('+', $string);

            $this->setBuild(explode('.', $build));
        }

        if (false !== strpos($string, '-')) {
            list($string, $pre) = explode('-', $string);

            $this->setPreRelease(explode('.', $pre));
        }

        $version = explode('.', $string);

        $this->major = (int)$version[0];

        if (isset($version[1])) {
            $this->minor = (int)$version[1];
        }

        if (isset($version[2])) {
            $this->patch = (int)$version[2];
        }
    }
Parses the version string, replacing current any data.

@param string $string The string representation.

@throws InvalidArgumentException If the string is invalid.