Version.php 824 Bytes
Newer Older
1
<?php
2

3 4
namespace Doctrine\DBAL;

5 6 7 8
use function str_replace;
use function strtolower;
use function version_compare;

9
/**
Benjamin Morel's avatar
Benjamin Morel committed
10
 * Class to store and retrieve the version of Doctrine.
11
 *
Benjamin Morel's avatar
Benjamin Morel committed
12
 * @link   www.doctrine-project.org
13 14 15 16
 */
class Version
{
    /**
Benjamin Morel's avatar
Benjamin Morel committed
17
     * Current Doctrine Version.
18
     */
19
    public const VERSION = '2.9.0-DEV';
20 21 22 23

    /**
     * Compares a Doctrine version with the current one.
     *
Benjamin Morel's avatar
Benjamin Morel committed
24 25
     * @param string $version The Doctrine version to compare to.
     *
26
     * @return int -1 if older, 0 if it is the same, 1 if version passed as argument is newer.
27 28 29 30
     */
    public static function compare($version)
    {
        $currentVersion = str_replace(' ', '', strtolower(self::VERSION));
31
        $version        = str_replace(' ', '', $version);
32 33 34

        return version_compare($version, $currentVersion);
    }
35
}