index/src/Data/MariaDB/MariaDBCharacterSetInfo.php

94 lines
2.3 KiB
PHP

<?php
// MariaDBCharacterSetInfo.php
// Created: 2021-05-02
// Updated: 2022-02-02
namespace Index\Data\MariaDB;
use stdClass;
/**
* Contains information about the character set.
*
* @see https://www.php.net/manual/en/mysqli.get-charset
*/
class MariaDBCharacterSetInfo {
private stdClass $charSet;
/**
* Creates a new character set info instance.
*
* @param stdClass $charSet Anonymous object containing the information.
* @return MariaDBCharacterSetInfo Character set information class.
*/
public function __construct(stdClass $charSet) {
$this->charSet = $charSet;
}
/**
* Returns the name of the current character set.
*
* @return string Character set name.
*/
public function getCharacterSet(): string {
return $this->charSet->charset;
}
/**
* Returns the name of the default collation.
*
* @return string Default collation name.
*/
public function getDefaultCollation(): string {
return $this->charSet->collation;
}
/**
* Returns the path to the directory the charcter was read from.
* May be empty for built-in character sets.
*
* @return string Source directory.
*/
public function getDirectory(): string {
return $this->charSet->dir;
}
/**
* Returns the minimum character width in bytes for this character set.
*
* @return int Minimum character width in bytes.
*/
public function getMinimumWidth(): int {
return $this->charSet->min_length;
}
/**
* Returns the maximum character width in bytes for this character set.
*
* @return int Maximum character width in bytes.
*/
public function getMaximumWidth(): int {
return $this->charSet->max_length;
}
/**
* Returns the internal numeric identifier for this character set.
*
* @return int Character set identifier.
*/
public function getId(): int {
return $this->charSet->number;
}
/**
* Returns the character set status.
*
* Whatever that means. Given the (?) in the official documentation, not even they know.
*
* @return int Character set status.
*/
public function getState(): int {
return $this->charSet->state;
}
}