Skip to content
Snippets Groups Projects
Verified Commit 8aec3335 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Fix rector issues

parent 8b0774c8
No related branches found
No related tags found
1 merge request!6TYPO3 11
......@@ -40,13 +40,13 @@ use TYPO3\CMS\Core\Utility\VersionNumberUtility;
* YouTube Helper Service
*/
class YoutubeService {
const API_URL = 'https://www.googleapis.com/youtube/v3/';
const API_CHANNEL = 'search';
const API_PLAYLIST = 'playlistItems';
const API_VIDEO = 'videos';
const API_PART = 'snippet';
const API_PART_LOCALIZATIONS = 'localizations';
const API_ORDER_BY = 'date';
public const API_URL = 'https://www.googleapis.com/youtube/v3/';
public const API_CHANNEL = 'search';
public const API_PLAYLIST = 'playlistItems';
public const API_VIDEO = 'videos';
public const API_PART = 'snippet';
public const API_PART_LOCALIZATIONS = 'localizations';
public const API_ORDER_BY = 'date';
/**
* Maps the json array from the YouTube call to return some unified value. The output from YouTube is pretty
......@@ -158,7 +158,7 @@ class YoutubeService {
$localizationData = $this->getDetailedVideoInformationForJsonArray(
$jsonArray, $apiKey, self::API_PART_LOCALIZATIONS
);
if (!isset($localizationData['items']) || count($localizationData['items']) <= 0) {
if (!isset($localizationData['items']) || (is_countable($localizationData['items']) ? count($localizationData['items']) : 0) <= 0) {
return $jsonArray;
}
......@@ -190,7 +190,7 @@ class YoutubeService {
}
foreach ($localizationData['items'] as $index => $localizationEntry) {
if (!isset($localizationEntry['localizations']) || count($localizationEntry['localizations']) <= 0) {
if (!isset($localizationEntry['localizations']) || (is_countable($localizationEntry['localizations']) ? count($localizationEntry['localizations']) : 0) <= 0) {
continue;
}
......@@ -266,7 +266,7 @@ class YoutubeService {
}
$result = $this->getJsonAsArray('', '10', $apiKey, $apiUrl . '?' . $query);
if (!isset($result['items']) || count($result['items']) <= 0) {
if (!isset($result['items']) || (is_countable($result['items']) ? count($result['items']) : 0) <= 0) {
return $jsonArray;
}
......@@ -339,7 +339,7 @@ class YoutubeService {
throw new InvalidArgumentException('No items array.', 403);
}
if (count($jsonArray['items']) < 1) {
if ((is_countable($jsonArray['items']) ? count($jsonArray['items']) : 0) < 1) {
throw new InvalidArgumentException('No items found.', 403);
}
......
......@@ -6,7 +6,7 @@ $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['sgyoutube_yo
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'SGalinski.sg_youtube',
'Srectorprefix20211231gYoutube',
'Youtube',
'YouTube Videos'
);
......@@ -24,15 +24,15 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
if (!defined('TYPO3_MODE')) {
if (!defined('TYPO3')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'SGalinski.sg_youtube',
'Srectorprefix20211231gYoutube',
'Youtube',
[
'Youtube' => 'index',
\SGalinski\Srectorprefix20211231gYoutube\Controller\YoutubeController::class => 'index',
],
// non-cacheable actions
......
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