Yoast\WP\SEO\Presentations

Abstract_Presentation::of()publicYoast 1.0

Creates a model presentation.

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

Хуков нет.

Возвращает

static. A model presentation.

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

$Abstract_Presentation = new Abstract_Presentation();
$Abstract_Presentation->of( $data );
$data(массив) (обязательный)
The data that this is a presentation of.

Код Abstract_Presentation::of() Yoast 22.3

public function of( $data ) {
	if ( ! $this->is_prototype() ) {
		throw new Exception( 'Attempting to create a model presentation from another model presentation. Use the prototype presentation gained from DI instead.' );
	}

	// Clone self to allow stateful services that do benefit from DI.
	$presentation = clone $this;
	foreach ( $data as $key => $value ) {
		$presentation->{$key} = $value;
	}
	$presentation->is_prototype = false;
	return $presentation;
}