Version.php
changeset 133 550862f07e6a
equal deleted inserted replaced
132:077ea5b34caf 133:550862f07e6a
       
     1 <?php
       
     2 /*
       
     3  * This file is part of the WikiTagBundle package.
       
     4  *
       
     5  * (c) IRI <http://www.iri.centrepompidou.fr/>
       
     6  *
       
     7  * For the full copyright and license information, please view the LICENSE
       
     8  * file that was distributed with this source code.
       
     9  */
       
    10 
       
    11 namespace IRI\Bundle\WikiTagBundle;
       
    12 
       
    13 /**
       
    14  * Class to store and retrieve WikiTagBundle Version
       
    15  *
       
    16  */
       
    17 class Version {
       
    18 
       
    19     /** 
       
    20      * Current WikiTagBundle Version
       
    21      */
       
    22     const VERSION = '0.18';
       
    23 
       
    24     /** 
       
    25      * Compares a WikiTagBundlee version with the current one.
       
    26      *
       
    27      * @param string $version WikiTageBundle version to compare.
       
    28      * @return int Returns -1 if older, 0 if it is the same, 1 if version 
       
    29      *             passed as argument is newer.
       
    30      */
       
    31     public static function compare($version)
       
    32     {   
       
    33         $currentVersion = str_replace(' ', '', strtolower(self::VERSION));
       
    34         $version = str_replace(' ', '', $version);
       
    35 
       
    36         return version_compare($version, $currentVersion);
       
    37     }   
       
    38 
       
    39 }