Version.php
changeset 133 550862f07e6a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Version.php	Fri Sep 26 10:03:23 2014 +0200
@@ -0,0 +1,39 @@
+<?php
+/*
+ * This file is part of the WikiTagBundle package.
+ *
+ * (c) IRI <http://www.iri.centrepompidou.fr/>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace IRI\Bundle\WikiTagBundle;
+
+/**
+ * Class to store and retrieve WikiTagBundle Version
+ *
+ */
+class Version {
+
+    /** 
+     * Current WikiTagBundle Version
+     */
+    const VERSION = '0.18';
+
+    /** 
+     * Compares a WikiTagBundlee version with the current one.
+     *
+     * @param string $version WikiTageBundle version to compare.
+     * @return int Returns -1 if older, 0 if it is the same, 1 if version 
+     *             passed as argument is newer.
+     */
+    public static function compare($version)
+    {   
+        $currentVersion = str_replace(' ', '', strtolower(self::VERSION));
+        $version = str_replace(' ', '', $version);
+
+        return version_compare($version, $currentVersion);
+    }   
+
+}