Yoast\WP\SEO
Loader::get_class
Gets a class from the container.
Метод класса: Loader{}
Хуков нет.
Возвращает
Объект|null. The class or, in production environments, null if it does not exist.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_class( $class_name );
- $class_name(строка) (обязательный)
- The class name.
Код Loader::get_class() Loader::get class Yoast 26.9
protected function get_class( $class_name ) {
try {
return $this->container->get( $class_name );
} catch ( Throwable $e ) {
// In production environments do not fatal if the class could not be constructed but log and fail gracefully.
if ( \YOAST_ENVIRONMENT === 'production' ) {
if ( \defined( 'WP_DEBUG' ) && \WP_DEBUG ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
\error_log( $e->getMessage() );
}
return null;
}
throw $e;
}
}