public static function compareTo(Version $left, Version $right)
    {
        switch (true) {
            case ($left->getMajor() < $right->getMajor()):
                return self::LESS_THAN;
            case ($left->getMajor() > $right->getMajor()):
                return self::GREATER_THAN;
            case ($left->getMinor() > $right->getMinor()):
                return self::GREATER_THAN;
            case ($left->getMinor() < $right->getMinor()):
                return self::LESS_THAN;
            case ($left->getPatch() > $right->getPatch()):
                return self::GREATER_THAN;
            case ($left->getPatch() < $right->getPatch()):
                return self::LESS_THAN;
            // @codeCoverageIgnoreStart
        }
        // @codeCoverageIgnoreEnd

        return self::compareIdentifiers(
            $left->getPreRelease(),
            $right->getPreRelease()
        );
    }
public static function compareTo(Version $left, Version $right)
    {
        switch (true) {
            case ($left->getMajor() < $right->getMajor()):
                return self::LESS_THAN;
            case ($left->getMajor() > $right->getMajor()):
                return self::GREATER_THAN;
            case ($left->getMinor() > $right->getMinor()):
                return self::GREATER_THAN;
            case ($left->getMinor() < $right->getMinor()):
                return self::LESS_THAN;
            case ($left->getPatch() > $right->getPatch()):
                return self::GREATER_THAN;
            case ($left->getPatch() < $right->getPatch()):
                return self::LESS_THAN;
            // @codeCoverageIgnoreStart
        }
        // @codeCoverageIgnoreEnd

        return self::compareIdentifiers(
            $left->getPreRelease(),
            $right->getPreRelease()
        );
    }
public static function compareTo ( Version $ left , Version $ right ) { switch ( true ) { case ( $ left -> getMajor ( ) < $ right -> getMajor ( ) ) : return self :: LESS_THAN ; case ( $ left -> getMajor ( ) > $ right -> getMajor ( ) ) : return self :: GREATER_THAN ; case ( $ left -> getMinor ( ) > $ right -> getMinor ( ) ) : return self :: GREATER_THAN ; case ( $ left -> getMinor ( ) < $ right -> getMinor ( ) ) : return self :: LESS_THAN ; case ( $ left -> getPatch ( ) > $ right -> getPatch ( ) ) : return self :: GREATER_THAN ; case ( $ left -> getPatch ( ) < $ right -> getPatch ( ) ) : return self :: LESS_THAN ; // @codeCoverageIgnoreStart } // @codeCoverageIgnoreEnd return self :: compareIdentifiers ( $ left -> getPreRelease ( ) , $ right -> getPreRelease ( ) ) ; }
Compares one version with another.

@param Version $left  The left version to compare.
@param Version $right The right version to compare.

@return integer Returns Comparator::EQUAL_TO if the two versions are
equal. If the left version is less than the right
version, Comparator::LESS_THAN is returned. If the left
version is greater than the right version,
Comparator::GREATER_THAN is returned.
Compares one version with another .