mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +00:00

- update .devcontainer settings: remove auto-formatting for php + set intelephense as default formatter - remove prettier php plugin as it lacks php 8 support - add captain hook action for checking style pre-commit - fix style with ecs on all files except views
43 lines
930 B
PHP
43 lines
930 B
PHP
<?php
|
|
|
|
/**
|
|
* @copyright 2020 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace App\Entities;
|
|
|
|
use ActivityPub\Entities\Actor as ActivityPubActor;
|
|
use App\Models\PodcastModel;
|
|
use RuntimeException;
|
|
|
|
/**
|
|
* @property Podcast|null $podcast
|
|
* @property boolean $is_podcast
|
|
*/
|
|
class Actor extends ActivityPubActor
|
|
{
|
|
protected ?Podcast $podcast = null;
|
|
|
|
protected bool $is_podcast;
|
|
|
|
public function getIsPodcast(): bool
|
|
{
|
|
return $this->podcast !== null;
|
|
}
|
|
|
|
public function getPodcast(): ?Podcast
|
|
{
|
|
if ($this->id === null) {
|
|
throw new RuntimeException('Podcast id must be set before getting associated podcast.',);
|
|
}
|
|
|
|
if ($this->podcast === null) {
|
|
$this->podcast = (new PodcastModel())->getPodcastByActorId($this->id,);
|
|
}
|
|
|
|
return $this->podcast;
|
|
}
|
|
}
|