aiwass/src/Aiwass.php

35 lines
902 B
PHP
Raw Normal View History

2024-08-13 00:54:50 +00:00
<?php
// Aiwass.php
// Created: 2024-08-13
// Updated: 2024-08-13
namespace Aiwass;
/**
* Provides information about the Aiwass library.
*/
final class Aiwass {
public const PATH_SOURCE = __DIR__;
public const PATH_ROOT = self::PATH_SOURCE . DIRECTORY_SEPARATOR . '..';
public const PATH_VERSION = self::PATH_ROOT . DIRECTORY_SEPARATOR . 'VERSION';
/**
* Gets the current version of the Aiwass library.
*
* Reads the VERSION file in the root of the Aiwass directory.
* Returns 0.0.0 if reading the file failed for any reason.
*
* @return string Current version string.
*/
public static function version(): string {
if(!is_file(self::PATH_VERSION))
return '0.0.0';
$version = file_get_contents(self::PATH_VERSION);
if($version === false)
return '0.0.0';
return trim($version);
}
}