Yoast\WP\SEO\Builders

Indexable_Post_Builder::empty_string_to_null()protectedYoast 1.0

Transforms an empty string into null. Leaves non-empty strings intact.

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

Хуков нет.

Возвращает

Строку|null. The input string or null.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->empty_string_to_null( $text );
$text(строка) (обязательный)
The string.

Код Indexable_Post_Builder::empty_string_to_null() Yoast 22.4

protected function empty_string_to_null( $text ) {
	if ( ! \is_string( $text ) || $text === '' ) {
		return null;
	}

	return $text;
}