You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace core\entities;
|
|
|
|
|
|
|
|
use yii\helpers\Json;
|
|
|
|
|
|
|
|
class Meta
|
|
|
|
{
|
|
|
|
public $title;
|
|
|
|
public $description;
|
|
|
|
public $keywords;
|
|
|
|
|
|
|
|
public function __construct($title, $description, $keywords)
|
|
|
|
{
|
|
|
|
$this->title = $title;
|
|
|
|
$this->description = $description;
|
|
|
|
$this->keywords = $keywords;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function createMeta($json): Meta
|
|
|
|
{
|
|
|
|
$meta = new Meta(null, null, null);
|
|
|
|
$meta_data = Json::decode($json);
|
|
|
|
$meta->title = isset($meta_data->title) ? $meta_data->title : '';
|
|
|
|
$meta->description = isset($meta_data->description) ? $meta_data->description : '';
|
|
|
|
$meta->keywords = isset($meta_data->keywords) ? $meta_data->keywords : '';
|
|
|
|
return $meta;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|