andersundsehr/aus_driver_amazon_s3

View on GitHub

Showing 23 of 23 total issues

File AmazonS3Driver.php has 975 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 74 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

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      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

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      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->normalizeIdentifier($folderIdentifier);
              $files = [];
              if ($folderIdentifier === self::ROOT_FOLDER_IDENTIFIER) {
      Severity: Minor
      Found in Classes/Driver/AmazonS3Driver.php - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      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

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      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

        Method initializeClient has 40 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

          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

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function getListObjects has a Cognitive Complexity of 13 (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

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          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->normalizeIdentifier($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

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                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 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function upload(string $localFilePath, string $targetFilePath, string $bucket, string $cacheControl)
                      {
                          $fileInfo = finfo_open(FILEINFO_MIME_TYPE);
                          $contentType = finfo_file($fileInfo, $localFilePath);
                          finfo_close($fileInfo);
                  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

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    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

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language