public static function toComponents($version)
    {
        if (!Validator::isVersion($version)) {
            throw new InvalidStringRepresentationException($version);
        }

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

            $build = explode('.', $build);
        }

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

            $pre = explode('.', $pre);
        }

        list(
            $major,
            $minor,
            $patch
        ) = explode('.', $version);

        return array(
            self::MAJOR => intval($major),
            self::MINOR => intval($minor),
            self::PATCH => intval($patch),
            self::PRE_RELEASE => isset($pre) ? $pre : array(),
            self::BUILD => isset($build) ? $build : array(),
        );
    }
public static function toComponents($version)
    {
        if (!Validator::isVersion($version)) {
            throw new InvalidStringRepresentationException($version);
        }

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

            $build = explode('.', $build);
        }

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

            $pre = explode('.', $pre);
        }

        list(
            $major,
            $minor,
            $patch
        ) = explode('.', $version);

        return array(
            self::MAJOR => intval($major),
            self::MINOR => intval($minor),
            self::PATCH => intval($patch),
            self::PRE_RELEASE => isset($pre) ? $pre : array(),
            self::BUILD => isset($build) ? $build : array(),
        );
    }
public static function toComponents ( $ version ) { if ( ! Validator :: isVersion ( $ version ) ) { throw new InvalidStringRepresentationException ( $ version ) ; } if ( false !== strpos ( $ version , '+' ) ) { list ( $ version , $ build ) = explode ( '+' , $ version ) ; $ build = explode ( '.' , $ build ) ; } if ( false !== strpos ( $ version , '-' ) ) { list ( $ version , $ pre ) = explode ( '-' , $ version ) ; $ pre = explode ( '.' , $ pre ) ; } list ( $ major , $ minor , $ patch ) = explode ( '.' , $ version ) ; return array ( self :: MAJOR => intval ( $ major ) , self :: MINOR => intval ( $ minor ) , self :: PATCH => intval ( $ patch ) , self :: PRE_RELEASE => isset ( $ pre ) ? $ pre : array ( ) , self :: BUILD => isset ( $ build ) ? $ build : array ( ) , ) ; }
Returns the components of the string representation.

@param string $version The string representation.

@return array The components of the version.

@throws InvalidStringRepresentationException If the string representation
is invalid.
Returns the components of the string representation .