1<?php
2/**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 *
8 */
9
10namespace Piwik;
11
12/**
13 * Matomo version information.
14 *
15 * @api
16 */
17final class Version
18{
19    /**
20     * The current Matomo version.
21     * @var string
22     */
23    const VERSION = '4.6.2';
24
25    const MAJOR_VERSION = 4;
26
27    public function isStableVersion($version)
28    {
29        return (bool) preg_match('/^(\d+)\.(\d+)\.(\d+)$/', $version);
30    }
31
32    public function isVersionNumber($version)
33    {
34        return $this->isStableVersion($version) || $this->isNonStableVersion($version);
35    }
36
37    private function isNonStableVersion($version)
38    {
39        return (bool) preg_match('/^(\d+)\.(\d+)\.(\d+)-.{1,4}(\d+)$/', $version);
40    }
41}
42