Yoast\WP\Lib

Model::get_table_name_for_class()protected staticYoast 1.0

Static method to get a table name given a class name. If the supplied class has a public static property named $table, the value of this property will be returned.

If not, the class name will be converted using the class_name_to_table_name() method.

If Model::$short_table_names == true or public static property $table_use_short_name == true then $class_name passed to class_name_to_table_name() is stripped of namespace information.

Метод класса: Model{}

Хуков нет.

Возвращает

Строку. The table name.

Использование

$result = Model::get_table_name_for_class( $class_name );
$class_name(строка) (обязательный)
The class name to get the table name for.

Код Model::get_table_name_for_class() Yoast 22.3

protected static function get_table_name_for_class( $class_name ) {
	$specified_table_name = static::get_static_property( $class_name, 'table' );
	$use_short_class_name = static::use_short_table_name( $class_name );
	if ( $use_short_class_name ) {
		$exploded_class_name = \explode( '\\', $class_name );
		$class_name          = \end( $exploded_class_name );
	}

	if ( $specified_table_name === null ) {
		return static::class_name_to_table_name( $class_name );
	}

	return $specified_table_name;
}