1<?php 2/* 3 * This file is part of PHPUnit. 4 * 5 * (c) Sebastian Bergmann <sebastian@phpunit.de> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11use SebastianBergmann\Version; 12 13/** 14 * This class defines the current version of PHPUnit. 15 */ 16class PHPUnit_Runner_Version 17{ 18 private static $pharVersion; 19 private static $version; 20 21 /** 22 * Returns the current version of PHPUnit. 23 * 24 * @return string 25 */ 26 public static function id() 27 { 28 if (self::$pharVersion !== null) { 29 return self::$pharVersion; 30 } 31 32 if (self::$version === null) { 33 $version = new Version('5.7.27', dirname(dirname(__DIR__))); 34 self::$version = $version->getVersion(); 35 } 36 37 return self::$version; 38 } 39 40 /** 41 * @return string 42 */ 43 public static function series() 44 { 45 if (strpos(self::id(), '-')) { 46 $version = explode('-', self::id())[0]; 47 } else { 48 $version = self::id(); 49 } 50 51 return implode('.', array_slice(explode('.', $version), 0, 2)); 52 } 53 54 /** 55 * @return string 56 */ 57 public static function getVersionString() 58 { 59 return 'PHPUnit ' . self::id() . ' by Sebastian Bergmann and contributors.'; 60 } 61 62 /** 63 * @return string 64 */ 65 public static function getReleaseChannel() 66 { 67 if (strpos(self::$pharVersion, '-') !== false) { 68 return '-nightly'; 69 } 70 71 return ''; 72 } 73} 74