owncloud/core

View on GitHub
lib/private/Share20/DefaultShareProvider.php

Summary

Maintainability
F
1 wk
Test Coverage

File DefaultShareProvider.php has 866 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Björn Schießle <bjoern@schiessle.org>
 * @author Joas Schilling <coding@schilljs.com>
 * @author phisch <git@philippschaffrath.de>
Severity: Major
Found in lib/private/Share20/DefaultShareProvider.php - About 2 days to fix

    Function getSharedWith has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
            /** @var Share[] $shares */
            $shares = [];
    
            if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
    Severity: Minor
    Found in lib/private/Share20/DefaultShareProvider.php - About 4 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

    DefaultShareProvider has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DefaultShareProvider implements IShareProvider {
        // Special share type for user modified group shares
        public const SHARE_TYPE_USERGROUP = 2;
    
        /** @var IDBConnection */
    Severity: Minor
    Found in lib/private/Share20/DefaultShareProvider.php - About 3 hrs to fix

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

          public function getAllSharedWith($userId, $node) {
              // Create array of sharedWith objects (target user -> $userId or group of which user is a member
              $user = $this->userManager->get($userId);
      
              // Check if user is member of some groups and chunk them
      Severity: Minor
      Found in lib/private/Share20/DefaultShareProvider.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 update has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function update(\OCP\Share\IShare $share) {
              $this->validate($share);
      
              $shareAttributes = $this->formatShareAttributes(
                  $share->getAttributes()
      Severity: Major
      Found in lib/private/Share20/DefaultShareProvider.php - About 2 hrs to fix

        Method create has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function create(\OCP\Share\IShare $share) {
                $this->validate($share);
                $qb = $this->dbConn->getQueryBuilder();
        
                $qb->insert('share');
        Severity: Major
        Found in lib/private/Share20/DefaultShareProvider.php - About 2 hrs to fix

          Method updateForRecipient has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function updateForRecipient(\OCP\Share\IShare $share, $recipient) {
                  if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
                      if ($share->getSharedWith() !== $recipient) {
                          throw new ProviderException('Recipient does not match');
                      }
          Severity: Major
          Found in lib/private/Share20/DefaultShareProvider.php - About 2 hrs to fix

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

                public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
                    /** @var Share[] $shares */
                    $shares = [];
            
                    if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
            Severity: Minor
            Found in lib/private/Share20/DefaultShareProvider.php - About 2 hrs to fix

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

                  public function getAllSharedWith($userId, $node) {
                      // Create array of sharedWith objects (target user -> $userId or group of which user is a member
                      $user = $this->userManager->get($userId);
              
                      // Check if user is member of some groups and chunk them
              Severity: Minor
              Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

                Method getShareById has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getShareById($id, $recipientId = null) {
                        if (!ctype_digit($id)) {
                            // share id is defined as a field of type integer
                            // if someone calls the API asking for a share id like "abc"
                            // then there is no point trying to query the database,
                Severity: Minor
                Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

                  Method userDeleted has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function userDeleted($uid, $shareType) {
                          $qb = $this->dbConn->getQueryBuilder();
                  
                          $qb->delete('share');
                  
                  
                  Severity: Minor
                  Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

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

                        public function create(\OCP\Share\IShare $share) {
                            $this->validate($share);
                            $qb = $this->dbConn->getQueryBuilder();
                    
                            $qb->insert('share');
                    Severity: Minor
                    Found in lib/private/Share20/DefaultShareProvider.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 getAllSharesBy has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getAllSharesBy($userId, $shareTypes, $nodeIDs, $reshares) {
                            $shares = [];
                            $qb = $this->dbConn->getQueryBuilder();
                    
                            $qb->select('*')
                    Severity: Minor
                    Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

                      Method resolveGroupShares has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function resolveGroupShares($shares, $userId) {
                              $qb = $this->dbConn->getQueryBuilder();
                      
                              list($chunkedShareIds, $shareIdToShareMap) = $this->chunkSharesToMaps($shares);
                              foreach ($chunkedShareIds as $shareIdsChunk) {
                      Severity: Minor
                      Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

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

                            public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset) {
                                $qb = $this->dbConn->getQueryBuilder();
                                $qb->select('*')
                                    ->from('share')
                                    ->andWhere($qb->expr()->orX(
                        Severity: Minor
                        Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

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

                              public function updateForRecipient(\OCP\Share\IShare $share, $recipient) {
                                  if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
                                      if ($share->getSharedWith() !== $recipient) {
                                          throw new ProviderException('Recipient does not match');
                                      }
                          Severity: Minor
                          Found in lib/private/Share20/DefaultShareProvider.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 createShare has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function createShare($data) {
                                  $share = new Share($this->rootFolder, $this->userManager);
                                  $share->setId($data['id'])
                                      ->setShareType((int)$data['share_type'])
                                      ->setPermissions((int)$data['permissions'])
                          Severity: Minor
                          Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

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

                                private function resolveGroupShares($shares, $userId) {
                                    $qb = $this->dbConn->getQueryBuilder();
                            
                                    list($chunkedShareIds, $shareIdToShareMap) = $this->chunkSharesToMaps($shares);
                                    foreach ($chunkedShareIds as $shareIdsChunk) {
                            Severity: Minor
                            Found in lib/private/Share20/DefaultShareProvider.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 getSharedWithUserGroupQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function getSharedWithUserGroupQuery($groups, $userId, $node) {
                                    $qb = $this->dbConn->getQueryBuilder();
                                    $qb->select('s.*', 'f.fileid', 'f.path')
                                        ->selectAlias('st.id', 'storage_string_id')
                                        ->from('share', 's')
                            Severity: Minor
                            Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

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

                                  public function getSharesWithInvalidFileid(int $limit) {
                                      $validShareTypes = [
                                          \OCP\Share::SHARE_TYPE_USER,
                                          \OCP\Share::SHARE_TYPE_GROUP,
                                          \OCP\Share::SHARE_TYPE_LINK,
                              Severity: Minor
                              Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

                                Method getChildren has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function getChildren(\OCP\Share\IShare $parent) {
                                        $children = [];
                                
                                        $qb = $this->dbConn->getQueryBuilder();
                                        $qb->select('*')
                                Severity: Minor
                                Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

                                  Method getSharesBy has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset) {
                                  Severity: Minor
                                  Found in lib/private/Share20/DefaultShareProvider.php - About 45 mins to fix

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

                                        public function getShareById($id, $recipientId = null) {
                                            if (!ctype_digit($id)) {
                                                // share id is defined as a field of type integer
                                                // if someone calls the API asking for a share id like "abc"
                                                // then there is no point trying to query the database,
                                    Severity: Minor
                                    Found in lib/private/Share20/DefaultShareProvider.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

                                    Method getSharedWith has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
                                    Severity: Minor
                                    Found in lib/private/Share20/DefaultShareProvider.php - About 35 mins to fix

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

                                          public function getAllSharesBy($userId, $shareTypes, $nodeIDs, $reshares) {
                                              $shares = [];
                                              $qb = $this->dbConn->getQueryBuilder();
                                      
                                              $qb->select('*')
                                      Severity: Minor
                                      Found in lib/private/Share20/DefaultShareProvider.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 2 locations. Consider refactoring.
                                      Open

                                                  $qb->update('share')
                                                      ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())))
                                                      ->set('share_with', $qb->createNamedParameter($share->getSharedWith()))
                                                      ->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
                                                      ->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
                                      Severity: Major
                                      Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 1 hr to fix
                                      lib/private/Share20/DefaultShareProvider.php on lines 273..279

                                      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 107.

                                      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

                                                  $qb->update('share')
                                                      ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())))
                                                      ->set('share_with', $qb->createNamedParameter($share->getPassword()))
                                                      ->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
                                                      ->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
                                      Severity: Major
                                      Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 1 hr to fix
                                      lib/private/Share20/DefaultShareProvider.php on lines 219..225

                                      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 107.

                                      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

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

                                              $qb = $qb->select('s.*')
                                                  ->from('share', 's')
                                                  ->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
                                                  ->where($qb->expr()->isNull('f.fileid'))
                                                  ->andWhere(
                                      Severity: Minor
                                      Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 1 hr to fix
                                      apps/federatedfilesharing/lib/FederatedShareProvider.php on lines 872..882

                                      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 100.

                                      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

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

                                              if ($reshares === false) {
                                                  $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)));
                                              } else {
                                                  $qb->andWhere(
                                                      $qb->expr()->orX(
                                      Severity: Minor
                                      Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 55 mins to fix
                                      lib/private/Share20/DefaultShareProvider.php on lines 473..482

                                      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 99.

                                      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

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

                                              if ($reshares === false) {
                                                  $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)));
                                              } else {
                                                  $qb->andWhere(
                                                      $qb->expr()->orX(
                                      Severity: Minor
                                      Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 55 mins to fix
                                      lib/private/Share20/DefaultShareProvider.php on lines 519..528

                                      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 99.

                                      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

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

                                              $qb->select('s.*', 'f.fileid', 'f.path')
                                                  ->selectAlias('st.id', 'storage_string_id')
                                                  ->from('share', 's')
                                                  ->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
                                                  ->leftJoin('f', 'storages', 'st', $qb->expr()->eq('f.storage', 'st.numeric_id'))
                                      Severity: Minor
                                      Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 40 mins to fix
                                      lib/private/Share20/DefaultShareProvider.php on lines 708..713

                                      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 93.

                                      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

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

                                              $qb->select('s.*', 'f.fileid', 'f.path')
                                                  ->selectAlias('st.id', 'storage_string_id')
                                                  ->from('share', 's')
                                                  ->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
                                                  ->leftJoin('f', 'storages', 'st', $qb->expr()->eq('f.storage', 'st.numeric_id'))
                                      Severity: Minor
                                      Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 40 mins to fix
                                      lib/private/Share20/DefaultShareProvider.php on lines 747..752

                                      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 93.

                                      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