wikimedia/mediawiki-core

View on GitHub
includes/libs/filebackend/FileBackendStore.php

Summary

Maintainability
F
1 wk
Test Coverage

File FileBackendStore.php has 1074 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Base class for all backends using particular storage medium.
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in includes/libs/filebackend/FileBackendStore.php - About 2 days to fix

    FileBackendStore has 89 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class FileBackendStore extends FileBackend {
        /** @var WANObjectCache */
        protected $memCache;
        /** @var BagOStuff */
        protected $srvCache;
    Severity: Major
    Found in includes/libs/filebackend/FileBackendStore.php - About 1 day to fix

      Function getFileStat has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          final public function getFileStat( array $params ) {
              /** @noinspection PhpUnusedLocalVariableInspection */
              $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
      
              $path = self::normalizeStoragePath( $params['src'] );
      Severity: Minor
      Found in includes/libs/filebackend/FileBackendStore.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 resolveStoragePath has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          final protected function resolveStoragePath( $storagePath ) {
              [ $backend, $shortCont, $relPath ] = self::splitStoragePath( $storagePath );
              if ( $backend === $this->name ) { // must be for this backend
                  $relPath = self::normalizeContainerPath( $relPath );
                  if ( $relPath !== null && self::isValidShortContainerName( $shortCont ) ) {
      Severity: Minor
      Found in includes/libs/filebackend/FileBackendStore.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 doConcatenate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function doConcatenate( array $params ) {
              $status = $this->newStatus();
              $tmpPath = $params['dst'];
              unset( $params['latest'] );
      
      
      Severity: Minor
      Found in includes/libs/filebackend/FileBackendStore.php - About 2 hrs to fix

        Method ingestFreshFileStats has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            final protected function ingestFreshFileStats( array $stats, $latest ) {
                $success = true;
        
                foreach ( $stats as $path => $stat ) {
                    if ( is_array( $stat ) ) {
        Severity: Minor
        Found in includes/libs/filebackend/FileBackendStore.php - About 2 hrs to fix

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

              final protected function primeFileCache( array $items ) {
                  /** @noinspection PhpUnusedLocalVariableInspection */
                  $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
          
                  $paths = []; // list of storage paths
          Severity: Minor
          Found in includes/libs/filebackend/FileBackendStore.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 doConcatenate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function doConcatenate( array $params ) {
                  $status = $this->newStatus();
                  $tmpPath = $params['dst'];
                  unset( $params['latest'] );
          
          
          Severity: Minor
          Found in includes/libs/filebackend/FileBackendStore.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 doQuickOperationsInternal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              final protected function doQuickOperationsInternal( array $ops, array $opts ) {
                  /** @noinspection PhpUnusedLocalVariableInspection */
                  $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                  $status = $this->newStatus();
          
          
          Severity: Minor
          Found in includes/libs/filebackend/FileBackendStore.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 doQuickOperationsInternal has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              final protected function doQuickOperationsInternal( array $ops, array $opts ) {
                  /** @noinspection PhpUnusedLocalVariableInspection */
                  $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                  $status = $this->newStatus();
          
          
          Severity: Minor
          Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

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

                final protected function doClean( array $params ) {
                    /** @noinspection PhpUnusedLocalVariableInspection */
                    $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                    $status = $this->newStatus();
            
            
            Severity: Minor
            Found in includes/libs/filebackend/FileBackendStore.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 primeFileCache has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                final protected function primeFileCache( array $items ) {
                    /** @noinspection PhpUnusedLocalVariableInspection */
                    $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
            
                    $paths = []; // list of storage paths
            Severity: Minor
            Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

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

                  final protected function doOperationsInternal( array $ops, array $opts ) {
                      /** @noinspection PhpUnusedLocalVariableInspection */
                      $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                      $status = $this->newStatus();
              
              
              Severity: Minor
              Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

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

                    final public function getFileStat( array $params ) {
                        /** @noinspection PhpUnusedLocalVariableInspection */
                        $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                
                        $path = self::normalizeStoragePath( $params['src'] );
                Severity: Minor
                Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

                  Function getLocalReferenceMulti has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      final public function getLocalReferenceMulti( array $params ) {
                          /** @noinspection PhpUnusedLocalVariableInspection */
                          $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                  
                          $params = $this->setConcurrencyFlags( $params );
                  Severity: Minor
                  Found in includes/libs/filebackend/FileBackendStore.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 doClean has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      final protected function doClean( array $params ) {
                          /** @noinspection PhpUnusedLocalVariableInspection */
                          $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                          $status = $this->newStatus();
                  
                  
                  Severity: Minor
                  Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

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

                        final protected function ingestFreshFileStats( array $stats, $latest ) {
                            $success = true;
                    
                            foreach ( $stats as $path => $stat ) {
                                if ( is_array( $stat ) ) {
                    Severity: Minor
                    Found in includes/libs/filebackend/FileBackendStore.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 getContainerShard has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        final protected function getContainerShard( $container, $relPath ) {
                            [ $levels, $base, $repeat ] = $this->getContainerHashLevels( $container );
                            if ( $levels == 1 || $levels == 2 ) {
                                // Hash characters are either base 16 or 36
                                $char = ( $base == 36 ) ? '[0-9a-z]' : '[0-9a-f]';
                    Severity: Minor
                    Found in includes/libs/filebackend/FileBackendStore.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 getFileXAttributes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        final public function getFileXAttributes( array $params ) {
                            /** @noinspection PhpUnusedLocalVariableInspection */
                            $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                    
                            $path = self::normalizeStoragePath( $params['src'] );
                    Severity: Minor
                    Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

                      Method getFileSha1Base36 has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          final public function getFileSha1Base36( array $params ) {
                              /** @noinspection PhpUnusedLocalVariableInspection */
                              $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                      
                              $path = self::normalizeStoragePath( $params['src'] );
                      Severity: Minor
                      Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

                        Method getLocalReferenceMulti has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            final public function getLocalReferenceMulti( array $params ) {
                                /** @noinspection PhpUnusedLocalVariableInspection */
                                $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                        
                                $params = $this->setConcurrencyFlags( $params );
                        Severity: Minor
                        Found in includes/libs/filebackend/FileBackendStore.php - About 1 hr to fix

                          Function directoryExists has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              final public function directoryExists( array $params ) {
                                  [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] );
                                  if ( $dir === null ) {
                                      return self::EXISTENCE_ERROR; // invalid storage path
                                  }
                          Severity: Minor
                          Found in includes/libs/filebackend/FileBackendStore.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 doOperationsInternal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              final protected function doOperationsInternal( array $ops, array $opts ) {
                                  /** @noinspection PhpUnusedLocalVariableInspection */
                                  $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                                  $status = $this->newStatus();
                          
                          
                          Severity: Minor
                          Found in includes/libs/filebackend/FileBackendStore.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

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

                              final public function getFileXAttributes( array $params ) {
                                  /** @noinspection PhpUnusedLocalVariableInspection */
                                  $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                          
                                  $path = self::normalizeStoragePath( $params['src'] );
                          Severity: Minor
                          Found in includes/libs/filebackend/FileBackendStore.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

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

                              final public function getFileSha1Base36( array $params ) {
                                  /** @noinspection PhpUnusedLocalVariableInspection */
                                  $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                          
                                  $path = self::normalizeStoragePath( $params['src'] );
                          Severity: Minor
                          Found in includes/libs/filebackend/FileBackendStore.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

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

                              protected function sanitizeOpHeaders( array $op ) {
                                  static $longs = [ 'content-disposition' ];
                          
                                  if ( isset( $op['headers'] ) ) { // op sets HTTP headers
                                      $newHeaders = [];
                          Severity: Minor
                          Found in includes/libs/filebackend/FileBackendStore.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

                          Avoid deeply nested control flow statements.
                          Open

                                                  if ( $container !== null ) {
                                                      return [ $container, $relPath, $cShard ];
                                                  }
                          Severity: Major
                          Found in includes/libs/filebackend/FileBackendStore.php - About 45 mins to fix

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

                                final protected function primeContainerCache( array $items ) {
                                    /** @noinspection PhpUnusedLocalVariableInspection */
                                    $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                            
                                    $paths = []; // list of storage paths
                            Severity: Minor
                            Found in includes/libs/filebackend/FileBackendStore.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

                            Function getContainerHashLevels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                final protected function getContainerHashLevels( $container ) {
                                    if ( isset( $this->shardViaHashLevels[$container] ) ) {
                                        $config = $this->shardViaHashLevels[$container];
                                        $hashLevels = (int)$config['levels'];
                                        if ( $hashLevels == 1 || $hashLevels == 2 ) {
                            Severity: Minor
                            Found in includes/libs/filebackend/FileBackendStore.php - About 35 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

                            Avoid too many return statements within this method.
                            Open

                                        return $stat;
                            Severity: Major
                            Found in includes/libs/filebackend/FileBackendStore.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $status;
                              Severity: Major
                              Found in includes/libs/filebackend/FileBackendStore.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return $stat === self::RES_ERROR ? self::STAT_ERROR : self::STAT_ABSENT;
                                Severity: Major
                                Found in includes/libs/filebackend/FileBackendStore.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return $status;
                                  Severity: Major
                                  Found in includes/libs/filebackend/FileBackendStore.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return $status;
                                    Severity: Major
                                    Found in includes/libs/filebackend/FileBackendStore.php - About 30 mins to fix

                                      Function setConcurrencyFlags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          final protected function setConcurrencyFlags( array $opts ) {
                                              $opts['concurrency'] = 1; // off
                                              if ( $this->parallelize === 'implicit' ) {
                                                  if ( $opts['parallelize'] ?? true ) {
                                                      $opts['concurrency'] = $this->concurrency;
                                      Severity: Minor
                                      Found in includes/libs/filebackend/FileBackendStore.php - About 25 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

                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                      Open

                                          final protected function doPrepare( array $params ) {
                                              /** @noinspection PhpUnusedLocalVariableInspection */
                                              $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                                              $status = $this->newStatus();
                                      
                                      
                                      Severity: Major
                                      Found in includes/libs/filebackend/FileBackendStore.php and 2 other locations - About 6 hrs to fix
                                      includes/libs/filebackend/FileBackendStore.php on lines 503..526
                                      includes/libs/filebackend/FileBackendStore.php on lines 540..563

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 211.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                      Open

                                          final protected function doSecure( array $params ) {
                                              /** @noinspection PhpUnusedLocalVariableInspection */
                                              $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                                              $status = $this->newStatus();
                                      
                                      
                                      Severity: Major
                                      Found in includes/libs/filebackend/FileBackendStore.php and 2 other locations - About 6 hrs to fix
                                      includes/libs/filebackend/FileBackendStore.php on lines 466..489
                                      includes/libs/filebackend/FileBackendStore.php on lines 540..563

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 211.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 3 locations. Consider refactoring.
                                      Open

                                          final protected function doPublish( array $params ) {
                                              /** @noinspection PhpUnusedLocalVariableInspection */
                                              $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                                              $status = $this->newStatus();
                                      
                                      
                                      Severity: Major
                                      Found in includes/libs/filebackend/FileBackendStore.php and 2 other locations - About 6 hrs to fix
                                      includes/libs/filebackend/FileBackendStore.php on lines 466..489
                                      includes/libs/filebackend/FileBackendStore.php on lines 503..526

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 211.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                      Open

                                          final public function getDirectoryList( array $params ) {
                                              [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] );
                                              if ( $dir === null ) {
                                                  return self::EXISTENCE_ERROR; // invalid storage path
                                              }
                                      Severity: Major
                                      Found in includes/libs/filebackend/FileBackendStore.php and 1 other location - About 3 hrs to fix
                                      includes/libs/filebackend/FileBackendStore.php on lines 1151..1167

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 149.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                      Open

                                          final public function getFileList( array $params ) {
                                              [ $fullCont, $dir, $shard ] = $this->resolveStoragePath( $params['dir'] );
                                              if ( $dir === null ) {
                                                  return self::LIST_ERROR; // invalid storage path
                                              }
                                      Severity: Major
                                      Found in includes/libs/filebackend/FileBackendStore.php and 1 other location - About 3 hrs to fix
                                      includes/libs/filebackend/FileBackendStore.php on lines 1121..1137

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 149.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                      Open

                                          final public function storeInternal( array $params ) {
                                              /** @noinspection PhpUnusedLocalVariableInspection */
                                              $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                                      
                                              if ( filesize( $params['src'] ) > $this->maxFileSizeInternal() ) {
                                      Severity: Major
                                      Found in includes/libs/filebackend/FileBackendStore.php and 1 other location - About 3 hrs to fix
                                      includes/libs/filebackend/FileBackendStore.php on lines 136..152

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 145.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                      Open

                                          final public function createInternal( array $params ) {
                                              /** @noinspection PhpUnusedLocalVariableInspection */
                                              $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
                                      
                                              if ( strlen( $params['content'] ) > $this->maxFileSizeInternal() ) {
                                      Severity: Major
                                      Found in includes/libs/filebackend/FileBackendStore.php and 1 other location - About 3 hrs to fix
                                      includes/libs/filebackend/FileBackendStore.php on lines 179..195

                                      Duplicated Code

                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                      Tuning

                                      This issue has a mass of 145.

                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                      Refactorings

                                      Further Reading

                                      There are no issues that match your filters.

                                      Category
                                      Status