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.

29 lines
656 B

7 years ago
<?php
namespace core\entities;
use yii\helpers\Json;
7 years ago
class Meta
{
3 years ago
public string $title;
public string $description;
public string $keywords;
7 years ago
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);
3 years ago
$meta->title = $meta_data->title ?? '';
$meta->description = $meta_data->description ?? '';
$meta->keywords = $meta_data->keywords ?? '';
return $meta;
}
7 years ago
}