Skip to content
Snippets Groups Projects
Commit a18debf3 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[BUGFIX] Fix PHP 8 error

parent 66614c30
No related branches found
No related tags found
No related merge requests found
<?php
namespace SGalinski\SgYoutube\Controller;
/***************************************************************
* Copyright notice
* (c) sgalinski Internet Services (https://www.sgalinski.de)
......@@ -20,6 +18,8 @@ namespace SGalinski\SgYoutube\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace SGalinski\SgYoutube\Controller;
use Exception;
use SGalinski\SgYoutube\Service\CachedImageService;
use SGalinski\SgYoutube\Service\YoutubeService;
......@@ -31,7 +31,7 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Service\ImageService;
/**
* The Youtube Controller
* The YouTube Controller
*/
class YoutubeController extends ActionController {
/**
......@@ -66,10 +66,11 @@ class YoutubeController extends ActionController {
$filterIds = explode(',', $filterIds);
foreach ($filterIds as &$filterId) {
$filterId = trim($filterId, " ");
$filterId = trim($filterId, ' ');
}
unset($filterId);
$maxResultsWithFilters = (string) (intval($maxResults) + count($filterIds));
$maxResultsWithFilters = (string) ((int) $maxResults + count($filterIds));
try {
$jsonArray = $this->youtubeService->getJsonAsArray($id, $maxResultsWithFilters, $apiKey);
......@@ -77,7 +78,7 @@ class YoutubeController extends ActionController {
$jsonArray['items'] = array_filter($jsonArray['items'], function ($item) use ($filterIds) {
$videoId = $item['snippet']['resourceId']['videoId'] ?? $item['id'];
if (is_array($videoId)) {
$videoId = $videoId['videoId'];
$videoId = $videoId['videoId'] ?? 0;
}
foreach ($filterIds as $filterId) {
if ($videoId === $filterId) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment