Add check for EpisodeAction properties

- also add type hints and phpdocs
- add additional unit tests
- set integer types in EpisodeActionEntity
- correctly call static methods
- improve exception handling in EpisodeActionSaver
- remove unused method EpisodeActionWriter::purge()
This commit is contained in:
Matthias Gutjahr 2021-10-07 14:33:16 +02:00 committed by thrillfall
parent b41a57d3a5
commit 056b12a667
3 changed files with 10 additions and 3 deletions

View File

@ -53,7 +53,6 @@ class SubscriptionChangeController extends Controller {
* *
* @param int|null $since * @param int|null $since
* @return JSONResponse * @return JSONResponse
* @throws \Exception
*/ */
public function list(int $since = null): JSONResponse { public function list(int $since = null): JSONResponse {
$sinceDatetime = $this->createDateTimeFromTimestamp($since); $sinceDatetime = $this->createDateTimeFromTimestamp($since);
@ -66,7 +65,6 @@ class SubscriptionChangeController extends Controller {
/** /**
* @param int|null $since * @param int|null $since
*
* @return DateTime * @return DateTime
*/ */
private function createDateTimeFromTimestamp(?int $since): DateTime { private function createDateTimeFromTimestamp(?int $since): DateTime {
@ -77,7 +75,6 @@ class SubscriptionChangeController extends Controller {
/** /**
* @param array $allSubscribed * @param array $allSubscribed
*
* @return mixed * @return mixed
*/ */
private function extractUrlList(array $allSubscribed): array { private function extractUrlList(array $allSubscribed): array {

View File

@ -38,6 +38,11 @@ class EpisodeActionMapper extends QBMapper
} }
/**
* @param string $episodeIdentifier
* @param string $userId
* @return EpisodeActionEntity|null
*/
public function findByEpisodeIdentifier(string $episodeIdentifier, string $userId) : ?EpisodeActionEntity public function findByEpisodeIdentifier(string $episodeIdentifier, string $userId) : ?EpisodeActionEntity
{ {
$qb = $this->db->getQueryBuilder(); $qb = $this->db->getQueryBuilder();

View File

@ -30,6 +30,11 @@ class EpisodeActionRepository {
return $episodeActions; return $episodeActions;
} }
/**
* @param string $identifier
* @param string $userId
* @return EpisodeAction|null
*/
public function findByEpisodeIdentifier(string $identifier, string $userId): ?EpisodeAction { public function findByEpisodeIdentifier(string $identifier, string $userId): ?EpisodeAction {
$episodeActionEntity = $this->episodeActionMapper->findByEpisodeIdentifier($identifier, $userId); $episodeActionEntity = $this->episodeActionMapper->findByEpisodeIdentifier($identifier, $userId);