File AmazonS3Driver.php
has 1002 lines of code (exceeds 250 allowed). Consider refactoring.
<?php
/***
*
* This file is part of an extension for TYPO3 CMS.
AmazonS3Driver
has 75 functions (exceeds 20 allowed). Consider refactoring.
class AmazonS3Driver extends AbstractHierarchicalFilesystemDriver implements StreamableDriverInterface
{
const DRIVER_TYPE = 'AusDriverAmazonS3';
const EXTENSION_KEY = 'aus_driver_amazon_s3';
Function getFoldersInFolder
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
public function getFoldersInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $folderNameFilterCallbacks = [], $sort = '', $sortRev = false)
{
$this->normalizeIdentifier($folderIdentifier);
$folders = [];
Function getObjectPermissions
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
protected function getObjectPermissions($identifier)
{
$this->normalizeIdentifier($identifier);
if ($identifier === '') {
$identifier = self::ROOT_FOLDER_IDENTIFIER;
Function getFilesInFolder
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
public function getFilesInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $filenameFilterCallbacks = [], $sort = '', $sortRev = false)
{
$this->normalizeFolderIdentifier($folderIdentifier);
$files = [];
if ($folderIdentifier === self::ROOT_FOLDER_IDENTIFIER) {
Function deleteFolder
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
public function deleteFolder($folderIdentifier, $deleteRecursively = false)
{
if ($deleteRecursively) {
$items = $this->getListObjects($folderIdentifier);
foreach ($items['Contents'] ?? [] as $object) {
Function getListObjects
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
protected function getListObjects($identifier, $overrideArgs = [])
{
$args = [
'Bucket' => $this->configuration['bucket'] ?? '',
'Prefix' => $identifier,
Method initializeClient
has 44 lines of code (exceeds 25 allowed). Consider refactoring.
protected function initializeClient()
{
$configuration = [
'version' => '2006-03-01',
'region' => $this->configuration['region'] ?? '',
Method getObjectPermissions
has 42 lines of code (exceeds 25 allowed). Consider refactoring.
protected function getObjectPermissions($identifier)
{
$this->normalizeIdentifier($identifier);
if ($identifier === '') {
$identifier = self::ROOT_FOLDER_IDENTIFIER;
Function initializeClient
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
protected function initializeClient()
{
$configuration = [
'version' => '2006-03-01',
'region' => $this->configuration['region'] ?? '',
Method getFoldersInFolder
has 38 lines of code (exceeds 25 allowed). Consider refactoring.
public function getFoldersInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $folderNameFilterCallbacks = [], $sort = '', $sortRev = false)
{
$this->normalizeIdentifier($folderIdentifier);
$folders = [];
Method getFilesInFolder
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
public function getFilesInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $filenameFilterCallbacks = [], $sort = '', $sortRev = false)
{
$this->normalizeFolderIdentifier($folderIdentifier);
$files = [];
if ($folderIdentifier === self::ROOT_FOLDER_IDENTIFIER) {
Method addFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring.
public function addFile($localFilePath, $targetFolderIdentifier, $newFileName = '', $removeOriginal = true)
{
$newFileName = $this->sanitizeFileName($newFileName !== '' ? $newFileName : PathUtility::basename($localFilePath));
$targetIdentifier = $targetFolderIdentifier . $newFileName;
$localIdentifier = $localFilePath;
Function addFile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
public function addFile($localFilePath, $targetFolderIdentifier, $newFileName = '', $removeOriginal = true)
{
$newFileName = $this->sanitizeFileName($newFileName !== '' ? $newFileName : PathUtility::basename($localFilePath));
$targetIdentifier = $targetFolderIdentifier . $newFileName;
$localIdentifier = $localFilePath;
Method getListObjects
has 30 lines of code (exceeds 25 allowed). Consider refactoring.
protected function getListObjects($identifier, $overrideArgs = [])
{
$args = [
'Bucket' => $this->configuration['bucket'] ?? '',
'Prefix' => $identifier,
Function applyFilterMethodsToDirectoryItem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
protected function applyFilterMethodsToDirectoryItem(array $filterMethods, $itemName, $itemIdentifier, $parentIdentifier): bool
{
foreach ($filterMethods as $filter) {
if (is_callable($filter)) {
$result = $filter($itemName, $itemIdentifier, $parentIdentifier, [], $this);
Method getFilesInFolder
has 7 arguments (exceeds 4 allowed). Consider refactoring.
public function getFilesInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $filenameFilterCallbacks = [], $sort = '', $sortRev = false)
Method getFoldersInFolder
has 7 arguments (exceeds 4 allowed). Consider refactoring.
public function getFoldersInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $folderNameFilterCallbacks = [], $sort = '', $sortRev = false)
Function initializeSettings
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
protected function initializeSettings()
{
if (self::$settings === null) {
self::$settings = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::EXTENSION_KEY);
Function initializeBaseUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
protected function initializeBaseUrl()
{
$protocol = $this->configuration['protocol'] ?? '';
if ($protocol == 'auto') {
$protocol = GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
Function renameFolder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public function renameFolder($folderIdentifier, $newName)
{
$this->resetIdentifierMap();
$newName = $this->sanitizeFileName($newName);
There are no issues that match your filters.