代码拉取完成,页面将自动刷新
<?php
declare(strict_types=1);
namespace phpDocumentor;
use Jean85\PrettyVersions;
use OutOfBoundsException;
use function explode;
use function file_get_contents;
use function ltrim;
use function sprintf;
use function strpos;
use function trim;
final class Version
{
private const VERSION = '@package_version@';
/** @var string */
private $version;
public function __construct()
{
$this->version = $this->detectVersion();
}
private function detectVersion(): string
{
$version = self::VERSION;
// prevent replacing the version by the PEAR building
if (sprintf('%s%s%s', '@', 'package_version', '@') === self::VERSION) {
$version = trim(file_get_contents(__DIR__ . '/../../VERSION'));
// @codeCoverageIgnoreStart
try {
$packageVersion = PrettyVersions::getRootPackageVersion();
if ($packageVersion->getPrettyVersion() === $version) {
return $version;
}
$version = sprintf(
'%s-%s+%s',
$version,
$packageVersion->getShortVersion(),
$packageVersion->getShortReference(),
);
} catch (OutOfBoundsException) {
}
// @codeCoverageIgnoreEnd
}
return $version;
}
public function getVersion(): string
{
return ltrim($this->version, 'v');
}
public function getExtensionVersion(): string
{
if (strpos($this->version, '-') !== false) {
$version = explode('-', $this->version)[0];
return $version . '-dev';
}
return $this->version;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。