andersundsehr/aus_driver_amazon_s3

View on GitHub

Showing 22 of 22 total issues

File AmazonS3Driver.php has 1002 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
/***
*
* This file is part of an extension for TYPO3 CMS.
Severity: Major
Found in Classes/Driver/AmazonS3Driver.php - About 2 days to fix

    AmazonS3Driver has 75 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class AmazonS3Driver extends AbstractHierarchicalFilesystemDriver implements StreamableDriverInterface
    {
    const DRIVER_TYPE = 'AusDriverAmazonS3';
     
    const EXTENSION_KEY = 'aus_driver_amazon_s3';
    Severity: Major
    Found in Classes/Driver/AmazonS3Driver.php - About 1 day to fix

      Function getFoldersInFolder has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

      public function getFoldersInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $folderNameFilterCallbacks = [], $sort = '', $sortRev = false)
      {
      $this->normalizeIdentifier($folderIdentifier);
      $folders = [];
       
       
      Severity: Minor
      Found in Classes/Driver/AmazonS3Driver.php - About 5 hrs to fix

      Function getObjectPermissions has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      protected function getObjectPermissions($identifier)
      {
      $this->normalizeIdentifier($identifier);
      if ($identifier === '') {
      $identifier = self::ROOT_FOLDER_IDENTIFIER;
      Severity: Minor
      Found in Classes/Driver/AmazonS3Driver.php - About 3 hrs to fix

      Function getFilesInFolder has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      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) {
      Severity: Minor
      Found in Classes/Driver/AmazonS3Driver.php - About 2 hrs to fix

      Function deleteFolder has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      public function deleteFolder($folderIdentifier, $deleteRecursively = false)
      {
      if ($deleteRecursively) {
      $items = $this->getListObjects($folderIdentifier);
      foreach ($items['Contents'] ?? [] as $object) {
      Severity: Minor
      Found in Classes/Driver/AmazonS3Driver.php - About 2 hrs to fix

      Function getListObjects has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      protected function getListObjects($identifier, $overrideArgs = [])
      {
      $args = [
      'Bucket' => $this->configuration['bucket'] ?? '',
      'Prefix' => $identifier,
      Severity: Minor
      Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

      Method initializeClient has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      protected function initializeClient()
      {
      $configuration = [
      'version' => '2006-03-01',
      'region' => $this->configuration['region'] ?? '',
      Severity: Minor
      Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

        Method getObjectPermissions has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        protected function getObjectPermissions($identifier)
        {
        $this->normalizeIdentifier($identifier);
        if ($identifier === '') {
        $identifier = self::ROOT_FOLDER_IDENTIFIER;
        Severity: Minor
        Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

          Function initializeClient has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          protected function initializeClient()
          {
          $configuration = [
          'version' => '2006-03-01',
          'region' => $this->configuration['region'] ?? '',
          Severity: Minor
          Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

          Method getFoldersInFolder has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          public function getFoldersInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $folderNameFilterCallbacks = [], $sort = '', $sortRev = false)
          {
          $this->normalizeIdentifier($folderIdentifier);
          $folders = [];
           
           
          Severity: Minor
          Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

            Method getFilesInFolder has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            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) {
            Severity: Minor
            Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

              Method addFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              public function addFile($localFilePath, $targetFolderIdentifier, $newFileName = '', $removeOriginal = true)
              {
              $newFileName = $this->sanitizeFileName($newFileName !== '' ? $newFileName : PathUtility::basename($localFilePath));
              $targetIdentifier = $targetFolderIdentifier . $newFileName;
              $localIdentifier = $localFilePath;
              Severity: Minor
              Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

                Function addFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                public function addFile($localFilePath, $targetFolderIdentifier, $newFileName = '', $removeOriginal = true)
                {
                $newFileName = $this->sanitizeFileName($newFileName !== '' ? $newFileName : PathUtility::basename($localFilePath));
                $targetIdentifier = $targetFolderIdentifier . $newFileName;
                $localIdentifier = $localFilePath;
                Severity: Minor
                Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

                Method getListObjects has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                protected function getListObjects($identifier, $overrideArgs = [])
                {
                $args = [
                'Bucket' => $this->configuration['bucket'] ?? '',
                'Prefix' => $identifier,
                Severity: Minor
                Found in Classes/Driver/AmazonS3Driver.php - About 1 hr to fix

                  Method upload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  public function upload(string $localFilePath, string $targetFilePath, string $bucket, string $cacheControl): void
                  {
                  $contentType = $this->detectContentType($localFilePath, $targetFilePath);
                   
                  $uploader = new MultipartUploader($this->s3Client, $localFilePath, [
                  Severity: Minor
                  Found in Classes/S3Adapter/MultipartUploaderAdapter.php - About 1 hr to fix

                    Function applyFilterMethodsToDirectoryItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    protected function applyFilterMethodsToDirectoryItem(array $filterMethods, $itemName, $itemIdentifier, $parentIdentifier): bool
                    {
                    foreach ($filterMethods as $filter) {
                    if (is_callable($filter)) {
                    $result = $filter($itemName, $itemIdentifier, $parentIdentifier, [], $this);
                    Severity: Minor
                    Found in Classes/Driver/AmazonS3Driver.php - About 55 mins to fix

                    Method getFilesInFolder has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    public function getFilesInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $filenameFilterCallbacks = [], $sort = '', $sortRev = false)
                    Severity: Major
                    Found in Classes/Driver/AmazonS3Driver.php - About 50 mins to fix

                      Method getFoldersInFolder has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      public function getFoldersInFolder($folderIdentifier, $start = 0, $numberOfItems = 0, $recursive = false, array $folderNameFilterCallbacks = [], $sort = '', $sortRev = false)
                      Severity: Major
                      Found in Classes/Driver/AmazonS3Driver.php - About 50 mins to fix

                        Function initializeSettings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        protected function initializeSettings()
                        {
                        if (self::$settings === null) {
                        self::$settings = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::EXTENSION_KEY);
                         
                         
                        Severity: Minor
                        Found in Classes/Driver/AmazonS3Driver.php - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language