Newer
Older
<?php

Yassine Doghri
committed
declare(strict_types=1);
/**
* @copyright 2021 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
namespace App\Libraries;

Yassine Doghri
committed
use App\Entities\Podcast;

Yassine Doghri
committed
use Modules\Fediverse\Objects\ActorObject;
class PodcastActor extends ActorObject
{

Yassine Doghri
committed
protected string $rssFeed;

Yassine Doghri
committed
protected string $language;
protected string $category;
protected string $episodes;
public function __construct(Podcast $podcast)
{

Yassine Doghri
committed
parent::__construct($podcast->actor);
$this->context[] = 'https://github.com/Podcastindex-org/activitypub-spec-work/blob/main/docs/1.0.md';
$this->type = 'Podcast';
$this->rssFeed = $podcast->feed_url;
$this->language = $podcast->language_code;
$category = '';
if ($podcast->category->parent_id !== null) {

Yassine Doghri
committed
$category .= $podcast->category->parent->apple_category . ' › ';

Yassine Doghri
committed
}

Yassine Doghri
committed

Yassine Doghri
committed
$category .= $podcast->category->apple_category;

Yassine Doghri
committed
$this->category = $category;

Yassine Doghri
committed
$this->episodes = url_to('podcast-episodes', esc($podcast->handle));