Model::get_static_property()protected staticYoast 1.0

Retrieve the value of a static property on a class. If the class or the property does not exist, returns the default value supplied as the third argument (which defaults to null).

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

Хуков нет.


Разное|null. The value of the property.


$result = Model::get_static_property( $class_name, $property, $default_value );
$class_name(строка) (обязательный)
The target class name.
$property(строка) (обязательный)
The property to get the value for.
Default value when property does not exist.
По умолчанию: null

Код Model::get_static_property() Yoast 20.0

protected static function get_static_property( $class_name, $property, $default_value = null ) {
	if ( ! \class_exists( $class_name ) || ! \property_exists( $class_name, $property ) ) {
		return $default_value;

	if ( ! isset( $class_name::${$property} ) ) {
		return $default_value;

	return $class_name::${$property};