* @license https://www.php.net/license/3_01.txt PHP License 3.01 * @copyright (c) 1997-2023 The PHP Group * * @package TranTools * * @version $Id$ * @filesource * * * @property-read int $size Size of the file in kB (rounded) * @property-read int $mtime Timestamp of last modify * @property-read string $revision EN-Revision number * @property-read string $maintainer Translation maintainer * @property-read string $status Status of translation file * @property-read string $credits Credits to other file contributors * @property-read string $rev-revision Review revision number * @property-read string $reviewer Translation reviewer * */ class FileData { /** * @var bool * @internal defines if object contains en or translation file data */ protected $isTranslation; /** * @var array * @internal stores file meta and translation data * . size * . mtime * . revision * . en-revision * . maintainer * . status * . credits * . rev-revision * . reviewer */ protected $data; /** * @var string * @internal includes concatenated search tags */ protected static $tags; /** * Set base meta data and read the comment lines from the file head * * Usage example: * * * * * @param string $file File name to inspect * @param bool $isTrans Define if the specified file is a translation * @return void */ public function __construct($file, $isTrans) { self::$tags = implode('|', array( 'EN-Revision', 'Revision', 'Maintainer', 'Status', 'Credits', 'Rev-Revision', 'Reviewer', ) ); $this->isTranslation = (bool) $isTrans; $this->data = array(); $handle = fopen($file, 'r'); for ($i=0; $i<=9 || feof($handle); ++$i) { $rawFile = trim(fgets($handle)); switch (substr($rawFile, 0, 4)) { case '