Real stubs this time
All checks were successful
repod / nextcloud (push) Successful in 1m34s
repod / nodejs (push) Successful in 2m41s

This commit is contained in:
Michel Roux 2023-08-04 00:23:59 +02:00
parent df30ff2318
commit 8d72eee723
13 changed files with 228 additions and 61 deletions

View File

@ -31,5 +31,10 @@
<referencedClass name="Doctrine\DBAL\Schema\Table" /> <referencedClass name="Doctrine\DBAL\Schema\Table" />
</errorLevel> </errorLevel>
</UndefinedDocblockClass> </UndefinedDocblockClass>
<InvalidReturnType>
<errorLevel type="suppress">
<directory name="stubs" />
</errorLevel>
</InvalidReturnType>
</issueHandlers> </issueHandlers>
</psalm> </psalm>

View File

@ -17,28 +17,75 @@ namespace OCA\GPodderSync\Core\EpisodeAction;
* id: int * id: int
* } * }
*/ */
interface EpisodeAction class EpisodeAction
{ {
public function getPodcast(): string; /**
* @return string
*/
public function getPodcast()
{
}
public function getEpisode(): string; /**
* @return string
*/
public function getEpisode()
{
}
public function getAction(): string; /**
* @return string
*/
public function getAction()
{
}
public function getTimestamp(): string; /**
* @return string
*/
public function getTimestamp()
{
}
public function getStarted(): int; /**
* @return int
*/
public function getStarted()
{
}
public function getPosition(): int; /**
* @return int
*/
public function getPosition()
{
}
public function getTotal(): int; /**
* @return int
*/
public function getTotal()
{
}
public function getGuid(): ?string; /**
* @return ?string
*/
public function getGuid()
{
}
public function getId(): int; /**
* @return int
*/
public function getId()
{
}
/** /**
* @return EpisodeActionType * @return EpisodeActionType
*/ */
public function toArray(): array; public function toArray()
{
}
} }

View File

@ -4,12 +4,14 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\EpisodeAction; namespace OCA\GPodderSync\Core\EpisodeAction;
interface EpisodeActionReader class EpisodeActionReader
{ {
/** /**
* @param array $episodeActionsArray [] * @param array $episodeActionsArray []
* @return EpisodeAction[] * @return EpisodeAction[]
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function fromArray(array $episodeActionsArray): array; public function fromArray(array $episodeActionsArray)
{
}
} }

View File

@ -4,7 +4,12 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\EpisodeAction; namespace OCA\GPodderSync\Core\EpisodeAction;
interface EpisodeActionSaver class EpisodeActionSaver
{ {
public function saveEpisodeActions(array $episodeActionsArray, string $userId): array; /**
* @return array
*/
public function saveEpisodeActions(array $episodeActionsArray, string $userId)
{
}
} }

View File

@ -13,17 +13,23 @@ namespace OCA\GPodderSync\Core\PodcastData;
* play: int * play: int
* } * }
*/ */
interface PodcastActionCounts extends \JsonSerializable class PodcastActionCounts implements \JsonSerializable
{ {
public function incrementAction(string $action): void; public function incrementAction(string $action): void
{
}
/** /**
* @return PodcastActionCountsType * @return PodcastActionCountsType
*/ */
public function toArray(): array; public function toArray()
{
}
/** /**
* @return PodcastActionCountsType * @return PodcastActionCountsType
*/ */
public function jsonSerialize(): array; public function jsonSerialize(): mixed
{
}
} }

View File

@ -15,43 +15,88 @@ namespace OCA\GPodderSync\Core\PodcastData;
* imageBlob: ?string * imageBlob: ?string
* } * }
*/ */
interface PodcastData extends \JsonSerializable class PodcastData implements \JsonSerializable
{ {
public function __toString(): string; /**
* @return PodcastData
* @throws \Exception if the XML data could not be parsed
*/
public static function parseRssXml(string $xmlString, ?int $fetchedAtUnix = null)
{
}
/** /**
* @throws \Exception if the XML data could not be parsed * @return ?string
*/ */
public static function parseRssXml(string $xmlString, ?int $fetchedAtUnix = null): PodcastData; public function getTitle()
{
}
public function getTitle(): ?string; /**
* @return ?string
*/
public function getAuthor()
{
}
public function getAuthor(): ?string; /**
* @return ?string
*/
public function getLink()
{
}
public function getLink(): ?string; /**
* @return ?string
*/
public function getDescription()
{
}
public function getDescription(): ?string; /**
* @return ?string
*/
public function getImageUrl()
{
}
public function getImageUrl(): ?string; /**
* @return ?int
*/
public function getFetchedAtUnix()
{
}
public function getFetchedAtUnix(): ?int; /**
* @return ?string
*/
public function getImageBlob()
{
}
public function getImageBlob(): ?string; public function setImageBlob(?string $blob): void
{
public function setImageBlob(?string $blob): void; }
/** /**
* @return PodcastDataType * @return PodcastDataType
*/ */
public function toArray(): array; public function toArray()
{
}
/** /**
* @return PodcastDataType * @return PodcastDataType
*/ */
public function jsonSerialize(): array; public function jsonSerialize(): mixed
{
}
/** /**
* @param PodcastDataType $data * @param PodcastDataType $data
* @return PodcastData
*/ */
public static function fromArray(array $data): PodcastData; public static function fromArray(array $data)
{
}
} }

View File

@ -4,13 +4,33 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\PodcastData; namespace OCA\GPodderSync\Core\PodcastData;
interface PodcastDataReader class PodcastDataReader
{ {
public function getCachedOrFetchPodcastData(string $url, string $userId): ?PodcastData; /**
* @return ?PodcastData
*/
public function getCachedOrFetchPodcastData(string $url, string $userId)
{
}
public function fetchPodcastData(string $url, string $userId): ?PodcastData; /**
* @return ?PodcastData
*/
public function fetchPodcastData(string $url, string $userId)
{
}
public function tryGetCachedPodcastData(string $url): ?PodcastData; /**
* @return ?PodcastData
*/
public function tryGetCachedPodcastData(string $url)
{
}
public function trySetCachedPodcastData(string $url, PodcastData $data): bool; /**
* @return bool
*/
public function trySetCachedPodcastData(string $url, PodcastData $data)
{
}
} }

View File

@ -11,23 +11,44 @@ namespace OCA\GPodderSync\Core\PodcastData;
* actionCounts: PodcastActionCounts * actionCounts: PodcastActionCounts
* } * }
*/ */
interface PodcastMetrics extends \JsonSerializable class PodcastMetrics implements \JsonSerializable
{ {
public function getUrl(): string; /**
* @return string
*/
public function getUrl()
{
}
public function getActionCounts(): PodcastActionCounts; /**
* @return PodcastActionCounts
*/
public function getActionCounts()
{
}
public function getListenedSeconds(): int; /**
* @return int
*/
public function getListenedSeconds()
{
}
public function addListenedSeconds(int $seconds): void; public function addListenedSeconds(int $seconds): void
{
}
/** /**
* @return PodcastMetricsType * @return PodcastMetricsType
*/ */
public function toArray(): array; public function toArray()
{
}
/** /**
* @return PodcastMetricsType * @return PodcastMetricsType
*/ */
public function jsonSerialize(): array; public function jsonSerialize(): mixed
{
}
} }

View File

@ -4,10 +4,12 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\PodcastData; namespace OCA\GPodderSync\Core\PodcastData;
interface PodcastMetricsReader class PodcastMetricsReader
{ {
/** /**
* @return PodcastMetrics[] * @return PodcastMetrics[]
*/ */
public function metrics(string $userId): array; public function metrics(string $userId)
{
}
} }

View File

@ -4,11 +4,19 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\SubscriptionChange; namespace OCA\GPodderSync\Core\SubscriptionChange;
interface SubscriptionChange class SubscriptionChange
{ {
public function __toString(): string; /**
* @return bool
*/
public function isSubscribed()
{
}
public function isSubscribed(): bool; /**
* @return string
public function getUrl(): string; */
public function getUrl()
{
}
} }

View File

@ -4,10 +4,12 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\SubscriptionChange; namespace OCA\GPodderSync\Core\SubscriptionChange;
interface SubscriptionChangeRequestParser class SubscriptionChangeRequestParser
{ {
/** /**
* @return SubscriptionChange[] * @return SubscriptionChange[]
*/ */
public function createSubscriptionChangeList(array $urlsSubscribed, array $urlsUnsubscribed): array; public function createSubscriptionChangeList(array $urlsSubscribed, array $urlsUnsubscribed)
{
}
} }

View File

@ -4,7 +4,9 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\SubscriptionChange; namespace OCA\GPodderSync\Core\SubscriptionChange;
interface SubscriptionChangeSaver class SubscriptionChangeSaver
{ {
public function saveSubscriptionChanges(array $urlsSubscribed, array $urlsUnsubscribed, string $userId): void; public function saveSubscriptionChanges(array $urlsSubscribed, array $urlsUnsubscribed, string $userId): void
{
}
} }

View File

@ -4,10 +4,12 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Core\SubscriptionChange; namespace OCA\GPodderSync\Core\SubscriptionChange;
interface SubscriptionChangesReader class SubscriptionChangesReader
{ {
/** /**
* @return SubscriptionChange[] * @return SubscriptionChange[]
*/ */
public static function mapToSubscriptionsChanges(array $urls, bool $subscribed): array; public static function mapToSubscriptionsChanges(array $urls, bool $subscribed)
{
}
} }