owncloud/core

View on GitHub
apps/dav/lib/CalDAV/CalDavBackend.php

Summary

Maintainability
F
1 wk
Test Coverage

File CalDavBackend.php has 957 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Joas Schilling <coding@schilljs.com>
 * @author Stefan Weil <sw@weilnetz.de>
 * @author Thomas Citharel <tcit@tcit.fr>
Severity: Major
Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 2 days to fix

    CalDavBackend has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport {
        /**
         * We need to specify a max date, because we need to stop *somewhere*
         *
         * On 32 bit system the maximum for a signed integer is 2147483647, so
    Severity: Minor
    Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 5 hrs to fix

      Function getDenormalizedData has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getDenormalizedData($calendarData) {
              $vObject = Reader::read($calendarData);
              $componentType = null;
              $component = null;
              $firstOccurrence = null;
      Severity: Minor
      Found in apps/dav/lib/CalDAV/CalDavBackend.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

      Method getCalendarsForUser has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getCalendarsForUser($principalUri) {
              $principalUriOriginal = $principalUri;
              $principalUri = $this->convertPrincipal($principalUri, true);
              $fields = \array_values($this->propertyMap);
              $fields[] = 'id';
      Severity: Major
      Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 3 hrs to fix

        Function calendarQuery has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            public function calendarQuery($calendarId, array $filters) {
                $componentType = null;
                $requirePostFilter = true;
                $timeRange = null;
        
        
        Severity: Minor
        Found in apps/dav/lib/CalDAV/CalDavBackend.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

        Method getDenormalizedData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getDenormalizedData($calendarData) {
                $vObject = Reader::read($calendarData);
                $componentType = null;
                $component = null;
                $firstOccurrence = null;
        Severity: Major
        Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 2 hrs to fix

          Method calendarQuery has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function calendarQuery($calendarId, array $filters) {
                  $componentType = null;
                  $requirePostFilter = true;
                  $timeRange = null;
          
          
          Severity: Minor
          Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

            Method getPublicCalendars has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getPublicCalendars() {
                    $fields = \array_values($this->propertyMap);
                    $fields[] = 'a.id';
                    $fields[] = 'a.uri';
                    $fields[] = 'a.synctoken';
            Severity: Minor
            Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                  public function getPublicCalendar($uri) {
                      $fields = \array_values($this->propertyMap);
                      $fields[] = 'a.id';
                      $fields[] = 'a.uri';
                      $fields[] = 'a.synctoken';
              Severity: Minor
              Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

                Function getCalendarsForUser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getCalendarsForUser($principalUri) {
                        $principalUriOriginal = $principalUri;
                        $principalUri = $this->convertPrincipal($principalUri, true);
                        $fields = \array_values($this->propertyMap);
                        $fields[] = 'id';
                Severity: Minor
                Found in apps/dav/lib/CalDAV/CalDavBackend.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 getChangesForCalendar has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
                        // Current synctoken
                        $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
                        $stmt->execute([ $calendarId ]);
                        $currentToken = $stmt->fetchColumn(0);
                Severity: Minor
                Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                      public function getUsersOwnCalendars($principalUri) {
                          $principalUri = $this->convertPrincipal($principalUri, true);
                          $fields = \array_values($this->propertyMap);
                          $fields[] = 'id';
                          $fields[] = 'uri';
                  Severity: Minor
                  Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

                    Method getCalendarByUri has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getCalendarByUri($principal, $uri) {
                            $fields = \array_values($this->propertyMap);
                            $fields[] = 'id';
                            $fields[] = 'uri';
                            $fields[] = 'synctoken';
                    Severity: Minor
                    Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                          public function getCalendarById($calendarId) {
                              $fields = \array_values($this->propertyMap);
                              $fields[] = 'id';
                              $fields[] = 'uri';
                              $fields[] = 'synctoken';
                      Severity: Minor
                      Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

                        Method createCalendar has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function createCalendar($principalUri, $calendarUri, array $properties) {
                                $principalUri = $this->convertPrincipal($principalUri, true);
                                $values = [
                                    'principaluri' => $principalUri,
                                    'uri'          => $calendarUri,
                        Severity: Minor
                        Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                              public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
                                  // Current synctoken
                                  $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
                                  $stmt->execute([ $calendarId ]);
                                  $currentToken = $stmt->fetchColumn(0);
                          Severity: Minor
                          Found in apps/dav/lib/CalDAV/CalDavBackend.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 getMultipleCalendarObjects has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getMultipleCalendarObjects($calendarId, array $uris) {
                                  $chunkSize = 998;
                                  if (\count($uris) <= $chunkSize) {
                                      $query = $this->db->getQueryBuilder();
                                      $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
                          Severity: Minor
                          Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                                public function getSubscriptionsForUser($principalUri) {
                                    $fields = \array_values($this->subscriptionPropertyMap);
                                    $fields[] = 'id';
                                    $fields[] = 'uri';
                                    $fields[] = 'source';
                            Severity: Minor
                            Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                                  public function createSubscription($principalUri, $uri, array $properties) {
                                      if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
                                          throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
                                      }
                              
                              
                              Severity: Minor
                              Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                                    public function updateCalendar($calendarId, PropPatch $propPatch) {
                                        $supportedProperties = \array_keys($this->propertyMap);
                                        $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
                                
                                        $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
                                Severity: Minor
                                Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 1 hr to fix

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

                                      public function createCalendar($principalUri, $calendarUri, array $properties) {
                                          $principalUri = $this->convertPrincipal($principalUri, true);
                                          $values = [
                                              'principaluri' => $principalUri,
                                              'uri'          => $calendarUri,
                                  Severity: Minor
                                  Found in apps/dav/lib/CalDAV/CalDavBackend.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 createSubscription has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function createSubscription($principalUri, $uri, array $properties) {
                                          if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
                                              throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
                                          }
                                  
                                  
                                  Severity: Minor
                                  Found in apps/dav/lib/CalDAV/CalDavBackend.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          IDBConnection $db,
                                          Principal $principalBackend,
                                          GroupPrincipalBackend $groupPrincipalBackend,
                                          ISecureRandom $random,
                                          $legacyMode = false
                                  Severity: Minor
                                  Found in apps/dav/lib/CalDAV/CalDavBackend.php - About 35 mins to fix

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

                                        public function getUsersOwnCalendars($principalUri) {
                                            $principalUri = $this->convertPrincipal($principalUri, true);
                                            $fields = \array_values($this->propertyMap);
                                            $fields[] = 'id';
                                            $fields[] = 'uri';
                                    Severity: Minor
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.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

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

                                        public function getPublicCalendars() {
                                            $fields = \array_values($this->propertyMap);
                                            $fields[] = 'a.id';
                                            $fields[] = 'a.uri';
                                            $fields[] = 'a.synctoken';
                                    Severity: Minor
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.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

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

                                        public function getSubscriptionsForUser($principalUri) {
                                            $fields = \array_values($this->subscriptionPropertyMap);
                                            $fields[] = 'id';
                                            $fields[] = 'uri';
                                            $fields[] = 'source';
                                    Severity: Minor
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.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

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

                                            while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                                                $components = [];
                                                if ($row['components']) {
                                                    $components = \explode(',', $row['components']);
                                                }
                                    Severity: Major
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 day to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 287..310

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

                                    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

                                            while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                                                $components = [];
                                                if ($row['components']) {
                                                    $components = \explode(',', $row['components']);
                                                }
                                    Severity: Major
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 day to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 187..210

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

                                    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

                                            if ($syncToken) {
                                                $query = 'SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`';
                                    
                                                // Fetching all changes
                                                $stmt = $this->db->prepare($query, $limit ?: null, $limit ? 0 : null);
                                    Severity: Major
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 7 hrs to fix
                                    apps/dav/lib/CardDAV/CardDavBackend.php on lines 732..767

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

                                    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

                                                $calendar = [
                                                    'id' => $row['id'],
                                                    'uri' => $row['publicuri'],
                                                    'principaluri' => $this->convertPrincipal($row['principaluri']),
                                                    '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?:'0'),
                                    Severity: Major
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 6 hrs to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 410..421

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

                                    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

                                            $calendar = [
                                                'id' => $row['id'],
                                                'uri' => $row['publicuri'],
                                                'principaluri' => $this->convertPrincipal($row['principaluri']),
                                                '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?:'0'),
                                    Severity: Major
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 6 hrs to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 346..357

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

                                    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

                                                    $result[] = [
                                                        'id'           => $row['id'],
                                                        'uri'          => $row['uri'],
                                                        'lastmodified' => $row['lastmodified'],
                                                        'etag'         => '"' . $row['etag'] . '"',
                                    Severity: Major
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 hr to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 736..746

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

                                    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

                                            return [
                                                    'id'            => $row['id'],
                                                    'uri'           => $row['uri'],
                                                    'lastmodified'  => $row['lastmodified'],
                                                    'etag'          => '"' . $row['etag'] . '"',
                                    Severity: Major
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 hr to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 775..785

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

                                    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

                                            $result = $query->select($fields)
                                                ->from('dav_shares', 's')
                                                ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
                                                ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
                                                ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
                                    Severity: Minor
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 45 mins to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 332..337

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

                                    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

                                            $result = $query->select($fields)
                                                ->from('dav_shares', 's')
                                                ->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
                                                ->where($query->expr()->in('s.access', $query->createNamedParameter(self::ACCESS_PUBLIC)))
                                                ->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
                                    Severity: Minor
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 45 mins to fix
                                    apps/dav/lib/CalDAV/CalDavBackend.php on lines 388..393

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

                                    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

                                        private function convertPrincipal($principalUri, $toV2 = null) {
                                            if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
                                                list(, $name) = \Sabre\Uri\split($principalUri);
                                                $toV2 = $toV2 === null ? !$this->legacyMode : $toV2;
                                                if ($toV2) {
                                    Severity: Minor
                                    Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 40 mins to fix
                                    apps/dav/lib/CardDAV/CardDavBackend.php on lines 1081..1091

                                    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