Add stubs for gpodder (maybe it'll be useless)

This commit is contained in:
Michel Roux 2023-06-24 18:37:25 +02:00
parent 9934d7f31c
commit 41250ea97d
19 changed files with 264 additions and 10 deletions

View File

@ -6,7 +6,16 @@ require_once './vendor/autoload.php';
use Nextcloud\CodingStandard\Config; use Nextcloud\CodingStandard\Config;
$config = new Config(); class MyConfig extends Config {
public function getRules(): array
{
$rules = parent::getRules();
$rules['curly_braces_position']['classes_opening_brace'] = 'next_line_unless_newline_at_signature_end';
return $rules;
}
}
$config = new MyConfig();
$config $config
->getFinder() ->getFinder()
->ignoreVCSIgnored(true) ->ignoreVCSIgnored(true)

View File

@ -15,6 +15,12 @@
"psalm:check": "psalm.phar --threads=1 --no-cache --show-info=true", "psalm:check": "psalm.phar --threads=1 --no-cache --show-info=true",
"psalm:fix": "psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType" "psalm:fix": "psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
}, },
"autoload": {
"psr-4": {
"OCA\\RePod\\": "lib/",
"OCA\\GPodderSync\\": "stubs/OCA/GPodderSync/"
}
},
"config": { "config": {
"platform": { "platform": {
"php": "8.0" "php": "8.0"

12
composer.lock generated
View File

@ -94,16 +94,16 @@
}, },
{ {
"name": "php-cs-fixer/shim", "name": "php-cs-fixer/shim",
"version": "v3.18.0", "version": "v3.19.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git", "url": "https://github.com/PHP-CS-Fixer/shim.git",
"reference": "a517e03dd0727336e502e071cc08e406ac878dba" "reference": "80586ec0e69fb4216edf4e8f830869a3e28d962d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/a517e03dd0727336e502e071cc08e406ac878dba", "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/80586ec0e69fb4216edf4e8f830869a3e28d962d",
"reference": "a517e03dd0727336e502e071cc08e406ac878dba", "reference": "80586ec0e69fb4216edf4e8f830869a3e28d962d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -140,9 +140,9 @@
"description": "A tool to automatically fix PHP code style", "description": "A tool to automatically fix PHP code style",
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues", "issues": "https://github.com/PHP-CS-Fixer/shim/issues",
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.18.0" "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.19.0"
}, },
"time": "2023-06-18T22:26:36+00:00" "time": "2023-06-24T11:07:33+00:00"
}, },
{ {
"name": "psalm/phar", "name": "psalm/phar",

View File

@ -6,7 +6,8 @@ namespace OCA\RePod\AppInfo;
use OCP\AppFramework\App; use OCP\AppFramework\App;
class Application extends App { class Application extends App
{
public const APP_ID = 'repod'; public const APP_ID = 'repod';
public function __construct() { public function __construct() {

View File

@ -10,7 +10,8 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest; use OCP\IRequest;
use OCP\Util; use OCP\Util;
class PageController extends Controller { class PageController extends Controller
{
public function __construct(IRequest $request) { public function __construct(IRequest $request) {
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }

View File

@ -10,6 +10,7 @@
> >
<projectFiles> <projectFiles>
<directory name="lib" /> <directory name="lib" />
<directory name="stubs" />
<ignoreFiles> <ignoreFiles>
<directory name="vendor" /> <directory name="vendor" />
</ignoreFiles> </ignoreFiles>

View File

@ -1,7 +1,7 @@
<template> <template>
<NcContent app-name="repod"> <NcContent app-name="repod">
<NcAppNavigation> <NcAppNavigation>
<NcAppNavigationNew :text="t('repod', 'New note')" <NcAppNavigationNew :text="t('repod', 'Add a podcast')"
@click="discover" /> @click="discover" />
<ul> <ul>
<NcAppNavigationItem v-for="note in notes" <NcAppNavigationItem v-for="note in notes"

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\EpisodeAction;
interface EpisodeAction
{
public function getPodcast(): string;
public function getEpisode(): string;
public function getAction(): string;
public function getTimestamp(): string;
public function getStarted(): int;
public function getPosition(): int;
public function getTotal(): int;
public function getGuid() : ?string;
public function getId(): int;
/**
* @return array<string,mixed>
*/
public function toArray(): array;
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\EpisodeAction;
use InvalidArgumentException;
interface EpisodeActionReader
{
/**
* @param array $episodeActionsArray []
* @return EpisodeAction[]
* @throws InvalidArgumentException
*/
public function fromArray(array $episodeActionsArray): array;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\EpisodeAction;
interface EpisodeActionSaver
{
public function saveEpisodeActions(array $episodeActionsArray, string $userId): array;
}

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\PodcastData;
use JsonSerializable;
interface PodcastActionCounts extends JsonSerializable
{
public function incrementAction(string $action): void;
/**
* @return array<string, int>
*/
public function toArray(): array;
/**
* @return array<string, int>
*/
public function jsonSerialize(): array;
}

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\PodcastData;
use Exception;
use JsonSerializable;
interface PodcastData extends JsonSerializable
{
/**
* @return PodcastData
* @throws Exception if the XML data could not be parsed.
*/
public static function parseRssXml(string $xmlString, ?int $fetchedAtUnix = null): PodcastData;
public function getTitle(): ?string;
public function getAuthor(): ?string;
public function getLink(): ?string;
public function getDescription(): ?string;
public function getImageUrl(): ?string;
public function getFetchedAtUnix(): ?int;
public function getImageBlob(): ?string;
public function setImageBlob(?string $blob): void;
public function __toString() : string;
/**
* @return array<string,mixed>
*/
public function toArray(): array;
/**
* @return array<string,mixed>
*/
public function jsonSerialize(): array;
public static function fromArray(array $data): PodcastData;
}

View File

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\PodcastData;
interface PodcastDataReader
{
public function getCachedOrFetchPodcastData(string $url, string $userId): ?PodcastData;
public function fetchPodcastData(string $url, string $userId): ?PodcastData;
public function tryGetCachedPodcastData(string $url): ?PodcastData;
public function trySetCachedPodcastData(string $url, PodcastData $data): bool;
}

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Core\PodcastData;
use JsonSerializable;
interface PodcastMetrics extends JsonSerializable
{
public function getUrl(): string;
public function getActionCounts(): PodcastActionCounts;
public function getListenedSeconds(): int;
public function addListenedSeconds(int $seconds): void;
/**
* @return array<string,mixed>
*/
public function toArray(): array;
/**
* @return array<string,mixed>
*/
public function jsonSerialize(): array;
}

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace OCA\NextPod\Core\PodcastData;
use OCA\GPodderSync\Core\PodcastData\PodcastMetrics;
interface PodcastMetricsReader
{
/**
* @return PodcastMetrics[]
*/
public function metrics(string $userId): array;
}

View File

@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace OCA\NextPod\Core\SubscriptionChange;
interface SubscriptionChange
{
public function isSubscribed(): bool;
public function getUrl(): string;
public function __toString() : string;
}

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace OCA\NextPod\Core\SubscriptionChange;
interface SubscriptionChangeRequestParser
{
/**
* @return SubscriptionChange[]
*/
public function createSubscriptionChangeList(array $urlsSubscribed, array $urlsUnsubscribed): array;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace OCA\NextPod\Core\SubscriptionChange;
interface SubscriptionChangeSaver
{
public function saveSubscriptionChanges(array $urlsSubscribed, array $urlsUnsubscribed, string $userId): void;
}

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace OCA\NextPod\Core\SubscriptionChange;
interface SubscriptionChangesReader
{
/**
* @return SubscriptionChange[]
*/
public static function mapToSubscriptionsChanges(array $urls, bool $subscribed): array;
}