YetiForceCompany/YetiForceCRM

View on GitHub
modules/API/models/CardDAV.php

Summary

Maintainability
F
3 days
Test Coverage
F
54%

File CardDAV.php has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Api CardDAV Model Class.
 *
Severity: Minor
Found in modules/API/models/CardDAV.php - About 5 hrs to fix

    The class API_CardDAV_Model has 11 public methods. Consider refactoring API_CardDAV_Model to keep number of public methods under 10.
    Open

    class API_CardDAV_Model
    {
        const ADDRESSBOOK_NAME = 'YFAddressBook';
        const PRODID = 'YetiForceCRM';
    
    
    Severity: Minor
    Found in modules/API/models/CardDAV.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class API_CardDAV_Model has an overall complexity of 81 which is very high. The configured complexity threshold is 50.
    Open

    class API_CardDAV_Model
    {
        const ADDRESSBOOK_NAME = 'YFAddressBook';
        const PRODID = 'YetiForceCRM';
    
    
    Severity: Minor
    Found in modules/API/models/CardDAV.php by phpmd

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

        public function syncAddressBooks(): int
        {
            \App\Log::trace('AddressBooks start', __METHOD__);
            $dataReader = $this->getDavCardsToSync()->createCommand()->query();
            $create = $deletes = $updates = $skipped = 0;
    Severity: Minor
    Found in modules/API/models/CardDAV.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function syncCrmRecord has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        public function syncCrmRecord($moduleName)
        {
            $create = $updates = 0;
            $query = $this->getCrmRecordsToSync($moduleName);
            if (!$query) {
    Severity: Minor
    Found in modules/API/models/CardDAV.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 setCardAddres has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
        {
            $adr1 = $adr2 = [];
            if ('Contacts' === $moduleName) {
                if (!empty($record['addresslevel5a'])) {
    Severity: Minor
    Found in modules/API/models/CardDAV.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 setCardAddres has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
        {
            $adr1 = $adr2 = [];
            if ('Contacts' === $moduleName) {
                if (!empty($record['addresslevel5a'])) {
    Severity: Major
    Found in modules/API/models/CardDAV.php - About 2 hrs to fix

      Method updateCard has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateCard($moduleName, $record, $card)
          {
              \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
              $vcard = Sabre\VObject\Reader::read($card['carddata']);
              $vcard->PRODID = self::PRODID;
      Severity: Minor
      Found in modules/API/models/CardDAV.php - About 1 hr to fix

        Method createCard has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createCard($moduleName, $record)
            {
                \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
        
                $vcard = new Sabre\VObject\Component\VCard();
        Severity: Minor
        Found in modules/API/models/CardDAV.php - About 1 hr to fix

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

              public function syncCrmRecord($moduleName)
              {
                  $create = $updates = 0;
                  $query = $this->getCrmRecordsToSync($moduleName);
                  if (!$query) {
          Severity: Minor
          Found in modules/API/models/CardDAV.php - About 1 hr to fix

            Method syncAddressBooks has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function syncAddressBooks(): int
                {
                    \App\Log::trace('AddressBooks start', __METHOD__);
                    $dataReader = $this->getDavCardsToSync()->createCommand()->query();
                    $create = $deletes = $updates = $skipped = 0;
            Severity: Minor
            Found in modules/API/models/CardDAV.php - About 1 hr to fix

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

                  public function updateCard($moduleName, $record, $card)
                  {
                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
                      $vcard = Sabre\VObject\Reader::read($card['carddata']);
                      $vcard->PRODID = self::PRODID;
              Severity: Minor
              Found in modules/API/models/CardDAV.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 createCard has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function createCard($moduleName, $record)
                  {
                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
              
                      $vcard = new Sabre\VObject\Component\VCard();
              Severity: Minor
              Found in modules/API/models/CardDAV.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

              The method syncCrmRecord() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
              Open

                  public function syncCrmRecord($moduleName)
                  {
                      $create = $updates = 0;
                      $query = $this->getCrmRecordsToSync($moduleName);
                      if (!$query) {
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

              Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

              The method setCardAddres() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
              Open

                  public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
                  {
                      $adr1 = $adr2 = [];
                      if ('Contacts' === $moduleName) {
                          if (!empty($record['addresslevel5a'])) {
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

              Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

              The method createCard() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
              Open

                  public function createCard($moduleName, $record)
                  {
                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
              
                      $vcard = new Sabre\VObject\Component\VCard();
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

              Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

              The method updateCard() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
              Open

                  public function updateCard($moduleName, $record, $card)
                  {
                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
                      $vcard = Sabre\VObject\Reader::read($card['carddata']);
                      $vcard->PRODID = self::PRODID;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

              Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

              The method syncAddressBooks() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
              Open

                  public function syncAddressBooks(): int
                  {
                      \App\Log::trace('AddressBooks start', __METHOD__);
                      $dataReader = $this->getDavCardsToSync()->createCommand()->query();
                      $create = $deletes = $updates = $skipped = 0;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              CyclomaticComplexity

              Since: 0.1

              Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

              Example

              // Cyclomatic Complexity = 11
              class Foo {
              1   public function example() {
              2       if ($a == $b) {
              3           if ($a1 == $b1) {
                              fiddle();
              4           } elseif ($a2 == $b2) {
                              fiddle();
                          } else {
                              fiddle();
                          }
              5       } elseif ($c == $d) {
              6           while ($c == $d) {
                              fiddle();
                          }
              7        } elseif ($e == $f) {
              8           for ($n = 0; $n < $h; $n++) {
                              fiddle();
                          }
                      } else {
                          switch ($z) {
              9               case 1:
                                  fiddle();
                                  break;
              10              case 2:
                                  fiddle();
                                  break;
              11              case 3:
                                  fiddle();
                                  break;
                              default:
                                  fiddle();
                                  break;
                          }
                      }
                  }
              }

              Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

              Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
              Open

                  public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed.
              Open

                  public function syncCrmRecord($moduleName)
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed.
              Open

                  public function syncAddressBooks(): int
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              The class API_CardDAV_Model has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13.
              Open

              class API_CardDAV_Model
              {
                  const ADDRESSBOOK_NAME = 'YFAddressBook';
                  const PRODID = 'YetiForceCRM';
              
              
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              CouplingBetweenObjects

              Since: 1.1.0

              A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

              Example

              class Foo {
                  /**
                   * @var \foo\bar\X
                   */
                  private $x = null;
              
                  /**
                   * @var \foo\bar\Y
                   */
                  private $y = null;
              
                  /**
                   * @var \foo\bar\Z
                   */
                  private $z = null;
              
                  public function setFoo(\Foo $foo) {}
                  public function setBar(\Bar $bar) {}
                  public function setBaz(\Baz $baz) {}
              
                  /**
                   * @return \SplObjectStorage
                   * @throws \OutOfRangeException
                   * @throws \InvalidArgumentException
                   * @throws \ErrorException
                   */
                  public function process(\Iterator $it) {}
              
                  // ...
              }

              Source https://phpmd.org/rules/design.html#couplingbetweenobjects

              Missing class import via use statement (line '41', column '20').
              Open

                      $this->pdo = new PDO($dbConfig['dsn'] . ';charset=' . $dbConfig['charset'], $dbConfig['username'], $dbConfig['password']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '194', column '16').
              Open

                      $vcard = new Sabre\VObject\Component\VCard();
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '403', column '15').
              Open

                      return (new App\Db\Query())->from('dav_cards')->where(['addressbookid' => $this->addressBookId, 'crmid' => $crmid])->one();
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '379', column '16').
              Open

                          return (new App\Db\Query())->select([
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '390', column '16').
              Open

                          return (new App\Db\Query())->select([
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '408', column '15').
              Open

                      return (new App\Db\Query())->select(['dav_cards.*', 'vtiger_crmentity.modifiedtime', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype'])
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Avoid using static access to class '\App\Fields\SharedOwner' in method 'syncCrmRecord'.
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($record['crmid']));
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'App\User' in method 'syncCrmRecord'.
              Open

                              $orgUserId = App\User::getCurrentUserId();
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Config' in method '__construct'.
              Open

                      $dbConfig = \App\Config::db('base');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Privilege' in method 'syncCrmRecord'.
              Open

                                      $isPermitted = \App\Privilege::isPermitted($moduleName, 'DetailView', $record['crmid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'App\User' in method 'syncCrmRecord'.
              Open

                              App\User::setCurrentUserId($userId);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Fields\SharedOwner' in method 'syncCrmRecord'.
              Open

                                      $shownerIds = \App\Fields\SharedOwner::getById($record['crmid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'crm2Dav'.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'Sabre\DAV\StringUtil' in method 'updateCard'.
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'deletedCard'.
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'dav2Crm'.
              Open

                      \App\Log::trace(__METHOD__ . ' | Start');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Fields\SharedOwner' in method 'syncAddressBooks'.
              Open

                                      $isPermitted = (int) $card['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($card['crmid']));
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Integrations\Dav\Card' in method 'deletedCard'.
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $card['crmid'] . '.vcf', 3);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'syncCrmRecord'.
              Open

                      \App\Log::trace("AddressBooks end - CRM >> DAV ({$moduleName}) | create: {$create} | updates: {$updates}", __METHOD__);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'vtlib\Functions' in method 'createCard'.
              Open

                          $org = vtlib\Functions::getCRMRecordLabel($record['parentid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'deletedCard'.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Integrations\Dav\Card' in method 'updateCard'.
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $card['uri'], 2);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Integrations\Dav\Card' in method 'updateRecord'.
              Open

                      $cartInstance = \App\Integrations\Dav\Card::loadFromContent($card['carddata']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              The method syncCrmRecord uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                                  } else {
                                      // Updating
                                      $this->updateCard($moduleName, $record, $card);
                                      ++$updates;
                                  }
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class 'vtlib\Functions' in method 'updateCard'.
              Open

                          $org = vtlib\Functions::getCRMRecordLabel($record['parentid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'crm2Dav'.
              Open

                      \App\Log::trace(__METHOD__ . ' | Start');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'App\User' in method 'syncCrmRecord'.
              Open

                              App\User::setCurrentUserId($orgUserId);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'dav2Crm'.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              The method syncAddressBooks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                              } else {
                                  ++$skipped;
                              }
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class '\App\Record' in method 'syncAddressBooks'.
              Open

                              if (!\App\Record::isExists($card['crmid']) || !$isPermitted) {
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'createCard'.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'createRecord'.
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID' . $card['id']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'Vtiger_Record_Model' in method 'createRecord'.
              Open

                      $record = Vtiger_Record_Model::getCleanInstance($moduleName);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'createRecord'.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              The method syncAddressBooks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                          } else {
                              $userId = (int) $this->user->getId();
                              if (isset(self::$cache[$userId][$card['crmid']])) {
                                  continue;
                              }
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              ElseExpression

              Since: 1.4.0

              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

              Example

              class Foo
              {
                  public function bar($flag)
                  {
                      if ($flag) {
                          // one branch
                      } else {
                          // another branch
                      }
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#elseexpression

              Avoid using static access to class '\App\Log' in method 'updateCard'.
              Open

                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Fields\SharedOwner' in method 'syncAddressBooks'.
              Open

                                      $shownerIds = \App\Fields\SharedOwner::getById($card['crmid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'updateCard'.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Integrations\Dav\Card' in method 'createRecord'.
              Open

                      $cartInstance = \App\Integrations\Dav\Card::loadFromContent($card['carddata']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'Sabre\DAV\StringUtil' in method 'createCard'.
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'updateRecord'.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'Sabre\VObject\Reader' in method 'updateCard'.
              Open

                      $vcard = Sabre\VObject\Reader::read($card['carddata']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'syncAddressBooks'.
              Open

                      \App\Log::trace('AddressBooks start', __METHOD__);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'createRecord'.
              Open

                          \App\Log::error("Not found N and FN part in vcard: Id: {$card['id']}, Addressbookid: {$card['addressbookid']}, Data: \n{$card['carddata']}", __CLASS__);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'createCard'.
              Open

                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Integrations\Dav\Card' in method 'createCard'.
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $cardUri, 1);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Privilege' in method 'syncAddressBooks'.
              Open

                                      $isPermitted = \App\Privilege::isPermitted($card['setype'], 'DetailView', $card['crmid']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class 'Vtiger_Record_Model' in method 'syncAddressBooks'.
              Open

                                  $this->updateRecord(Vtiger_Record_Model::getInstanceById($card['crmid'], $card['setype']), $card);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'syncAddressBooks'.
              Open

                      \App\Log::trace("AddressBooks end - DAV >> CRM | create: {$create} | deletes: {$deletes} | updates: {$skipped} | skipped: {$updates}", __METHOD__);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Avoid using static access to class '\App\Log' in method 'updateRecord'.
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              StaticAccess

              Since: 1.4.0

              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

              Example

              class Foo
              {
                  public function bar()
                  {
                      Bar::baz();
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#staticaccess

              Define a constant instead of duplicating this literal "crmid" 20 times.
              Open

                                      $isPermitted = \App\Privilege::isPermitted($moduleName, 'DetailView', $record['crmid']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "vtiger_crmentity.modifiedtime" 3 times.
              Open

                              'vtiger_crmentity.modifiedtime', 'vtiger_contactaddress.*',
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "OSSEmployees" 8 times.
              Open

                      'OSSEmployees' => ['business_mail' => 'WORK', 'private_mail' => 'HOME'],
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "vtiger_crmentity.smownerid" 3 times.
              Open

                              'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_contactdetails.parentid', 'vtiger_contactdetails.firstname',
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "vtiger_crmentity" 3 times.
              Open

                              ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "smownerid" 8 times.
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($record['crmid']));
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "Contacts" 9 times.
              Open

                      'Contacts' => ['email' => 'WORK', 'secondary_email' => 'HOME'],
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "carddata" 4 times.
              Open

                      $vcard = Sabre\VObject\Reader::read($card['carddata']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "lastname" 4 times.
              Open

                          $name = $record['firstname'] . ' ' . $record['lastname'];
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "groups" 4 times.
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId || \in_array($record['smownerid'], $user->get('groups')) || \in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $user->get('groups'))) > 0;
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "last_name" 4 times.
              Open

                          $name = $record['name'] . ' ' . $record['last_name'];
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "description" 4 times.
              Open

                      if (!empty($record['description'])) {
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "jobtitle" 4 times.
              Open

                          if (!empty($record['jobtitle'])) {
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "modifiedtime" 3 times.
              Open

                              } elseif (strtotime($card['modifiedtime']) < $card['lastmodified']) {
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal " | End" 7 times.
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Define a constant instead of duplicating this literal "firstname" 4 times.
              Open

                          $name = $record['firstname'] . ' ' . $record['lastname'];
              Severity: Critical
              Found in modules/API/models/CardDAV.php by sonar-php

              Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

              On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

              Noncompliant Code Example

              With the default threshold of 3:

              function run() {
                prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                execute('action1');
                release('action1');
              }
              

              Compliant Solution

              ACTION_1 = 'action1';
              
              function run() {
                prepare(ACTION_1);
                execute(ACTION_1);
                release(ACTION_1);
              }
              

              Exceptions

              To prevent generating some false-positives, literals having less than 5 characters are excluded.

              Call to method setCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
              Open

                              App\User::setCurrentUserId($userId);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Returning type 0 but syncCrmRecord() is declared to return string
              Open

                      return $create + $updates;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property PRODID from undeclared class \Sabre\VObject\Component\VCard
              Open

                      $vcard->PRODID = self::PRODID;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property FN from undeclared class \Sabre\VObject\Component
              Open

                      $vcard->FN = $name;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property NOTE from undeclared class \Sabre\VObject\Component
              Open

                          $vcard->NOTE = $record['description'];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Argument 1 (addressBookId) is false but \App\Integrations\Dav\Card::addChange() takes int defined at /code/app/Integrations/Dav/Card.php:137
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $card['uri'], 2);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace("AddressBooks end - CRM >> DAV ({$moduleName}) | create: {$create} | updates: {$updates}", __METHOD__);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | Start');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method ensureUTF8 from undeclared class \Sabre\DAV\StringUtil
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method read from undeclared class \Sabre\VObject\Reader
              Open

                      $vcard = Sabre\VObject\Reader::read($card['carddata']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component
              Open

                              $vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method prepare on non-class type false
              Open

                      $stmt = $this->pdo->prepare('UPDATE dav_cards SET carddata = ?, lastmodified = ?, size = ?, etag = ?, crmid = ? WHERE id = ?;');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method setCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
              Open

                              App\User::setCurrentUserId($orgUserId);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component\VCard
              Open

                          $vcard->add('NOTE', $record['description']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method serialize from undeclared class \Sabre\VObject\Component
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property N from undeclared class \Sabre\VObject\Component
              Open

                          $vcard->N = [$record['lastname'], $record['firstname']];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method setAttribute on non-class type false
              Open

                      $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | Start');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method __construct from undeclared class \Sabre\VObject\Component\VCard
              Open

                      $vcard = new Sabre\VObject\Component\VCard();
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method prepare on non-class type false
              Open

                      $stmt = $this->pdo->prepare('INSERT INTO dav_cards (carddata, uri, lastmodified, addressbookid, size, etag, crmid) VALUES (?, ?, ?, ?, ?, ?, ?)');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property ORG from undeclared class \Sabre\VObject\Component
              Open

                              $vcard->ORG = $org;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property ORG from undeclared class \Sabre\VObject\Component\VCard
              Open

                          $vcard->ORG = $record['company_name'];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Argument 1 (addressBookId) is false but \App\Integrations\Dav\Card::addChange() takes int defined at /code/app/Integrations/Dav/Card.php:137
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $cardUri, 1);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace("AddressBooks end - DAV >> CRM | create: {$create} | deletes: {$deletes} | updates: {$skipped} | skipped: {$updates}", __METHOD__);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Argument 1 (vcard) is \Sabre\VObject\Component\VCard but \API_CardDAV_Model::setCardAddres() takes \Sabre\VObject\Component defined at /code/modules/API/models/CardDAV.php:437
              Open

                      $vcard = $this->setCardAddres($vcard, $moduleName, $record);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Returning type void but syncCrmRecord() is declared to return string
              Open

                          return;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component\VCard
              Open

                              $vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component
              Open

                              $vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property ORG from undeclared class \Sabre\VObject\Component\VCard
              Open

                              $vcard->ORG = $org;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
              Open

                              $orgUserId = App\User::getCurrentUserId();
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace('AddressBooks start', __METHOD__);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property N from undeclared class \Sabre\VObject\Component
              Open

                          $vcard->N = [$record['last_name'], $record['name']];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component\VCard
              Open

                              $vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property N from undeclared class \Sabre\VObject\Component\VCard
              Open

                          $vcard->N = [$record['lastname'], $record['firstname']];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property TITLE from undeclared class \Sabre\VObject\Component
              Open

                              $vcard->TITLE = $record['jobtitle'];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property ORG from undeclared class \Sabre\VObject\Component
              Open

                          $vcard->ORG = $record['company_name'];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property TITLE from undeclared class \Sabre\VObject\Component\VCard
              Open

                              $vcard->TITLE = $record['jobtitle'];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method ensureUTF8 from undeclared class \Sabre\DAV\StringUtil
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method serialize from undeclared class \Sabre\VObject\Component
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Assigning \PDO to property but \API_CardDAV_Model->pdo is false
              Open

                      $this->pdo = new PDO($dbConfig['dsn'] . ';charset=' . $dbConfig['charset'], $dbConfig['username'], $dbConfig['password']);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property N from undeclared class \Sabre\VObject\Component\VCard
              Open

                          $vcard->N = [$record['last_name'], $record['name']];
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component\VCard
              Open

                      $vcard->add('FN', trim($name));
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Argument 1 (addressBookId) is false but \App\Integrations\Dav\Card::addChange() takes int defined at /code/app/Integrations/Dav/Card.php:137
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $card['crmid'] . '.vcf', 3);
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method prepare on non-class type false
              Open

                      $stmt = $this->pdo->prepare('DELETE FROM dav_cards WHERE id = ?;');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Returning type false but createRecord() is declared to return void
              Open

                          return false;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Parameter $vcard has undeclared type \Sabre\VObject\Component
              Open

                  public function cleanForUpdate(Sabre\VObject\Component $vcard)
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property ADR from undeclared class \Sabre\VObject\Component
              Open

                      $vcard->ADR = null;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property N from undeclared class \Sabre\VObject\Component\VCard
              Open

                      if (empty($cartInstance->getVCard()->N) && empty($cartInstance->getVCard()->FN)) {
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Return type of cleanForUpdate() is undeclared type \Sabre\VObject\Component
              Open

                  public function cleanForUpdate(Sabre\VObject\Component $vcard)
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to undeclared method \App\Db\Query::from
              Open

                      return (new App\Db\Query())->from('dav_cards')->where(['addressbookid' => $this->addressBookId, 'crmid' => $crmid])->one();
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property REV from undeclared class \Sabre\VObject\Component
              Open

                      $vcard->REV = null;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property TEL from undeclared class \Sabre\VObject\Component
              Open

                      $vcard->TEL = null;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component
              Open

                          $vcard->add('ADR', $adr2, ['type' => 'HOME']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Returning type true but createRecord() is declared to return void
              Open

                      return true;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to undeclared method \App\Db\Query::select
              Open

                          return (new App\Db\Query())->select([
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property FN from undeclared class \Sabre\VObject\Component\VCard
              Open

                      if (empty($cartInstance->getVCard()->N) && empty($cartInstance->getVCard()->FN)) {
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to method error from undeclared class \App\Log
              Open

                          \App\Log::error("Not found N and FN part in vcard: Id: {$card['id']}, Addressbookid: {$card['addressbookid']}, Data: \n{$card['carddata']}", __CLASS__);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | End');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Parameter $vcard has undeclared type \Sabre\VObject\Component
              Open

                  public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Return type of setCardAddres() is undeclared type \Sabre\VObject\Component
              Open

                  public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Reference to instance property EMAIL from undeclared class \Sabre\VObject\Component
              Open

                      $vcard->EMAIL = null;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phan

              Call to undeclared method \App\Db\Query::select
              Open

                          return (new App\Db\Query())->select([
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method trace from undeclared class \App\Log
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID' . $card['id']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method prepare on non-class type false
              Open

                      $stmt = $this->pdo->prepare($query);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method prepare on non-class type false
              Open

                      $stmt = $this->pdo->prepare('UPDATE dav_cards SET crmid = ? WHERE id = ?;');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method prepare on non-class type false
              Open

                      $stmt = $this->pdo->prepare('UPDATE vtiger_crmentity SET modifiedtime = ? WHERE crmid = ?;');
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to undeclared method \App\Db\Query::select
              Open

                      return (new App\Db\Query())->select(['dav_cards.*', 'vtiger_crmentity.modifiedtime', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype'])
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

              Call to method add from undeclared class \Sabre\VObject\Component
              Open

                          $vcard->add('ADR', $adr1, ['type' => 'WORK']);
              Severity: Critical
              Found in modules/API/models/CardDAV.php by phan

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

                                  case 'PLL_OWNER_PERSON_GROUP':
                                      $shownerIds = \App\Fields\SharedOwner::getById($card['crmid']);
                                      $isPermitted = (int) $card['smownerid'] === $userId || \in_array($card['smownerid'], $this->user->get('groups')) || \in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $this->user->get('groups'))) > 0;
                                      break;
              Severity: Major
              Found in modules/API/models/CardDAV.php and 1 other location - About 1 hr to fix
              modules/API/models/CalDAV.php on lines 377..380

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

              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 (!empty($record['addresslevel5a'])) {
                              $street = $record['addresslevel8a'] . ' ' . $record['buildingnumbera'];
                              if (!empty($record['localnumbera'])) {
                                  $street .= '/' . $record['localnumbera'];
                              }
              Severity: Major
              Found in modules/API/models/CardDAV.php and 1 other location - About 1 hr to fix
              modules/API/models/CardDAV.php on lines 454..466

              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

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

                          if (!empty($record['addresslevel5b'])) {
                              $street = $record['addresslevel8b'] . ' ' . $record['buildingnumberb'];
                              if (!empty($record['localnumberb'])) {
                                  $street .= '/' . $record['localnumberb'];
                              }
              Severity: Major
              Found in modules/API/models/CardDAV.php and 1 other location - About 1 hr to fix
              modules/API/models/CardDAV.php on lines 441..453

              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

              Each class must be in a namespace of at least one level (a top-level vendor name)
              Open

              class API_CardDAV_Model

              The class API_CardDAV_Model is not named in CamelCase.
              Open

              class API_CardDAV_Model
              {
                  const ADDRESSBOOK_NAME = 'YFAddressBook';
                  const PRODID = 'YetiForceCRM';
              
              
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              CamelCaseClassName

              Since: 0.2

              It is considered best practice to use the CamelCase notation to name classes.

              Example

              class class_name {
              }

              Source

              Avoid variables with short names like $i. Configured minimum length is 3.
              Open

                      $i = 0;
              Severity: Minor
              Found in modules/API/models/CardDAV.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Line exceeds 120 characters; contains 130 characters
              Open

                      $this->pdo = new PDO($dbConfig['dsn'] . ';charset=' . $dbConfig['charset'], $dbConfig['username'], $dbConfig['password']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return $log;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              App\User::setCurrentUserId($userId);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId || \in_array($record['smownerid'], $user->get('groups')) || \in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $user->get('groups'))) > 0;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Sync from CRM to DAV.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $query = $this->getCrmRecordsToSync($moduleName);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if (!$query) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          foreach ($this->davUsers as $userId => $user) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $this->addressBookId = $user->get('addressbooksid');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Line exceeds 120 characters; contains 236 characters
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId || \in_array($record['smownerid'], $user->get('groups')) || \in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $user->get('groups'))) > 0;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              if ($isPermitted) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  const ADDRESSBOOK_NAME = 'YFAddressBook';

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public $telFields = [

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  ];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  protected static $cache = [];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | Start');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_OWNER':

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  if (false === $card) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public $davUsers = [];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $dbConfig = \App\Config::db('base');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function crm2Dav(): string

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $log .= ' & OSSEmployees: ' . $this->syncCrmRecord('OSSEmployees');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          return;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              switch ($user->get('sync_carddav')) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($record['crmid']));

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  const PRODID = 'YetiForceCRM';

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @var Users_Record_Model[]

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      'OSSEmployees' => ['business_mail' => 'WORK', 'private_mail' => 'HOME'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      'OSSEmployees' => ['business_phone' => 'WORK', 'private_phone' => 'CELL'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Sync from CRM to DAV for one module.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $create = $updates = 0;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public $user = false;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @var bool|Users_Record_Model

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      'Contacts' => ['email' => 'WORK', 'secondary_email' => 'HOME'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | End');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param mixed $moduleName

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_OWNER_PERSON':

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  ];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $this->pdo = new PDO($dbConfig['dsn'] . ';charset=' . $dbConfig['charset'], $dbConfig['username'], $dbConfig['password']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $shownerIds = \App\Fields\SharedOwner::getById($record['crmid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $card = $this->getCardDetail($record['crmid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $log = 'Contacts: ' . $this->syncCrmRecord('Contacts');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      while ($record = $dataReader->read()) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $orgUserId = App\User::getCurrentUserId();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $this->createCard($moduleName, $record);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  protected $crmRecords = [];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = \App\Privilege::isPermitted($moduleName, 'DetailView', $record['crmid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  default:

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return string

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return string

              Line exceeds 120 characters; contains 152 characters
              Open

                                      $isPermitted = (int) $record['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($record['crmid']));

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      //Creating

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public $pdo = false;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      'Contacts' => ['phone' => 'WORK', 'mobile' => 'CELL'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function __construct()

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public $addressBookId = false;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function syncCrmRecord($moduleName)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $dataReader = $query->createCommand()->query();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_BASED_CREDENTIALS':

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public $mailFields = [

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_OWNER_PERSON_GROUP':

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | Start');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Sync from DAV to CRM for one user.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function syncAddressBooks(): int

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  default:

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return $create + $deletes + $updates;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function createCard($moduleName, $record)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->add('FN', trim($name));

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | End');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard = $this->cleanForUpdate($vcard);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      // Updating

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return int

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      foreach ($this->davUsers as $user) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $dataReader = $this->getDavCardsToSync()->createCommand()->query();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      while ($card = $dataReader->read()) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_OWNER_PERSON':

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard = new Sabre\VObject\Component\VCard();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $cardUri,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $this->addressBookId,

              Line exceeds 120 characters; contains 127 characters
              Open

                      \App\Log::trace("AddressBooks end - CRM >> DAV ({$moduleName}) | create: {$create} | updates: {$updates}", __METHOD__);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | End');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace('AddressBooks start', __METHOD__);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  ++$skipped;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = (int) $card['smownerid'] === $userId;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->N = [$record['lastname'], $record['firstname']];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if ('' != $org) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              if (!\App\Record::isExists($card['crmid']) || !$isPermitted) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  // Deleting

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  // Updating

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record['jobtitle'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      } elseif ('OSSEmployees' === $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard = $this->setCardAddres($vcard, $moduleName, $record);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->PRODID = self::PRODID;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $this->updateCard($moduleName, $record, $card);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $this->user = $user;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              //Creating

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_OWNER':

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              } elseif (strtotime($card['modifiedtime']) < $card['lastmodified']) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->N = [$record['last_name'], $record['name']];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $modifiedtime = strtotime($record['modifiedtime']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  ++$create;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if (!empty($record['description'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $etag,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = (int) $card['smownerid'] === $userId || \in_array($card['smownerid'], $this->user->get('groups')) || \in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $this->user->get('groups'))) > 0;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record[$key])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $userId = (int) $this->user->getId();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_OWNER_PERSON_GROUP':

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  } else {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return $create + $updates;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function dav2Crm(): int

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return int

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              if (isset(self::$cache[$userId][$card['crmid']])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  ++$deletes;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->ORG = $record['company_name'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->add('NOTE', $record['description']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt->execute([

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return $i;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              } else {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = (int) $card['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($card['crmid']));

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $this->deletedCard($card);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if ('Contacts' === $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $name = $record['firstname'] . ' ' . $record['lastname'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $org = vtlib\Functions::getCRMRecordLabel($record['parentid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      foreach ($this->telFields[$moduleName] as $key => $val) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cardUri = $record['crmid'] . '.vcf';

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $etag = md5($cardData);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      ++$updates;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace("AddressBooks end - CRM >> DAV ({$moduleName}) | create: {$create} | updates: {$updates}", __METHOD__);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!$card['crmid']) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $i = 0;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $i += $this->syncAddressBooks();

              Line exceeds 120 characters; contains 155 characters
              Open

                      \App\Log::trace("AddressBooks end - DAV >> CRM | create: {$create} | deletes: {$deletes} | updates: {$skipped} | skipped: {$updates}", __METHOD__);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record[$key])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      foreach ($this->mailFields[$moduleName] as $key => $val) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $record['crmid'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  self::$cache[$userId][$record['crmid']] = true;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $this->markComplete($moduleName, $record['crmid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $this->addressBookId = $user->get('addressbooksid');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  ++$updates;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $dataReader->close();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace("AddressBooks end - DAV >> CRM | create: {$create} | deletes: {$deletes} | updates: {$skipped} | skipped: {$updates}", __METHOD__);

              Line exceeds 120 characters; contains 154 characters
              Open

                      $stmt = $this->pdo->prepare('INSERT INTO dav_cards (carddata, uri, lastmodified, addressbookid, size, etag, crmid) VALUES (?, ?, ?, ?, ?, ?, ?)');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $modifiedtime,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function updateCard($moduleName, $record, $card)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      ++$create;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              App\User::setCurrentUserId($orgUserId);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $dataReader->close();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              if ($this->createRecord('Contacts', $card)) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  continue;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $this->updateRecord(Vtiger_Record_Model::getInstanceById($card['crmid'], $card['setype']), $card);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->PRODID = self::PRODID;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->ORG = $org;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          \strlen($cardData),

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $create = $deletes = $updates = $skipped = 0;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $isPermitted = \App\Privilege::isPermitted($card['setype'], 'DetailView', $card['crmid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      $shownerIds = \App\Fields\SharedOwner::getById($card['crmid']);

              Line exceeds 120 characters; contains 244 characters
              Open

                                      $isPermitted = (int) $card['smownerid'] === $userId || \in_array($card['smownerid'], $this->user->get('groups')) || \in_array($userId, $shownerIds) || \count(array_intersect($shownerIds, $this->user->get('groups'))) > 0;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->TITLE = $record['jobtitle'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $cardUri, 1);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Sync from DAV to CRM.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          } else {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              switch ($this->user->get('sync_carddav')) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  case 'PLL_BASED_CREDENTIALS':

              Line exceeds 120 characters; contains 148 characters
              Open

                                      $isPermitted = (int) $card['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($card['crmid']));

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                      break;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $name = $record['name'] . ' ' . $record['last_name'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt = $this->pdo->prepare('INSERT INTO dav_cards (carddata, uri, lastmodified, addressbookid, size, etag, crmid) VALUES (?, ?, ?, ?, ?, ?, ?)');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $cardData,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      ]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard = Sabre\VObject\Reader::read($card['carddata']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $name = $record['name'] . ' ' . $record['last_name'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->N = [$record['last_name'], $record['name']];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $card['id'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          return (new App\Db\Query())->select([

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if ('Contacts' === $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $org = vtlib\Functions::getCRMRecordLabel($record['parentid']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->TITLE = $record['jobtitle'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      foreach ($this->telFields[$moduleName] as $key => $val) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $cardData,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $record['crmid'],

              Line exceeds 120 characters; contains 164 characters
              Open

                          \App\Log::error("Not found N and FN part in vcard: Id: {$card['id']}, Addressbookid: {$card['addressbookid']}, Data: \n{$card['carddata']}", __CLASS__);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Update record.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return void

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_ossemployees.name', 'vtiger_ossemployees.last_name',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->NOTE = $record['description'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return true;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $record->getId(),

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              'vtiger_contactdetails.lastname', 'vtiger_contactdetails.phone', 'vtiger_contactdetails.mobile', 'vtiger_contactdetails.email',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ->where(['vtiger_ossemployees.dav_status' => 1, 'vtiger_crmentity.deleted' => 0]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function getCardDetail($crmid)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->N = [$record['lastname'], $record['firstname']];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record['jobtitle'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      ]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID' . $card['id']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Line exceeds 120 characters; contains 140 characters
              Open

                              'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_contactdetails.parentid', 'vtiger_contactdetails.firstname',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          ])->from('vtiger_contactdetails')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ->where(['vtiger_contactdetails.dav_status' => 1, 'vtiger_crmentity.deleted' => 0]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if ('OSSEmployees' === $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | End');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function deletedCard($card)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          \App\Log::error("Not found N and FN part in vcard: Id: {$card['id']}, Addressbookid: {$card['addressbookid']}, Data: \n{$card['carddata']}", __CLASS__);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  protected function updateIdAndModifiedTime(Vtiger_Record_Model $record, array $card)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt = $this->pdo->prepare('UPDATE dav_cards SET carddata = ?, lastmodified = ?, size = ?, etag = ?, crmid = ? WHERE id = ?;');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $etag,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $card['crmid'] . '.vcf', 3);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | End');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cartInstance->user = $this->user;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_contactdetails.parentid', 'vtiger_contactdetails.firstname',

              Line exceeds 120 characters; contains 121 characters
              Open

                              ->innerJoin('u_#__multicompany', 'vtiger_ossemployees.multicompanyid = u_#__multicompany.multicompanyid')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Integrations\Dav\Card::addChange($this->addressBookId, $card['uri'], 2);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return void

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $record = Vtiger_Record_Model::getCleanInstance($moduleName);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $record->getId(),

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      ]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          ])->from('vtiger_ossemployees')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->FN = $name;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record[$key])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      foreach ($this->mailFields[$moduleName] as $key => $val) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record[$key])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt->execute([

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt = $this->pdo->prepare('DELETE FROM dav_cards WHERE id = ?;');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cartInstance->setValuesForCreateRecord($record);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function updateRecord(Vtiger_Record_Model $record, array $card)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $record->save();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt->execute([

              Line exceeds 120 characters; contains 128 characters
              Open

                              ->innerJoin('vtiger_contactaddress', 'vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              'vtiger_ossemployees.private_mail', 'vtiger_crmentity.modifiedtime', 'u_#__multicompany.company_name',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ->innerJoin('u_#__multicompany', 'vtiger_ossemployees.multicompanyid = u_#__multicompany.multicompanyid')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->ORG = $record['company_name'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Create record.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param string $moduleName

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param array  $card

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | End');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt = $this->pdo->prepare('UPDATE vtiger_crmentity SET modifiedtime = ? WHERE crmid = ?;');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt->execute([

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $name = $record['firstname'] . ' ' . $record['lastname'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $etag = md5($cardData);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function createRecord(string $moduleName, array $card)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $this->updateIdAndModifiedTime($record, $card);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard = $this->setCardAddres($vcard, $moduleName, $record);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      ]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cartInstance->user = $this->user;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if (empty($cartInstance->getVCard()->N) && empty($cartInstance->getVCard()->FN)) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Line exceeds 120 characters; contains 143 characters
              Open

                              'vtiger_contactdetails.lastname', 'vtiger_contactdetails.phone', 'vtiger_contactdetails.mobile', 'vtiger_contactdetails.email',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($org)) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $vcard->ORG = $org;

              Line exceeds 120 characters; contains 136 characters
              Open

                      $stmt = $this->pdo->prepare('UPDATE dav_cards SET carddata = ?, lastmodified = ?, size = ?, etag = ?, crmid = ? WHERE id = ?;');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $card['id'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          return false;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $record->save();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param Vtiger_Record_Model $record

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          date('Y-m-d H:i:s', $card['lastmodified']),

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $modifiedtime,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt->execute([

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $this->updateIdAndModifiedTime($record, $card);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param array               $card

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cartInstance->setValuesForRecord($record);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Update ID and modified time.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              'vtiger_crmentity.modifiedtime', 'vtiger_contactaddress.*',

              Line exceeds 120 characters; contains 132 characters
              Open

                              'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_ossemployees.name', 'vtiger_ossemployees.last_name',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              'vtiger_ossemployees.business_phone', 'vtiger_ossemployees.private_phone', 'vtiger_ossemployees.business_mail',

              Line exceeds 120 characters; contains 127 characters
              Open

                              'vtiger_ossemployees.business_phone', 'vtiger_ossemployees.private_phone', 'vtiger_ossemployees.business_mail',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if (!empty($record['description'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $modifiedtime = strtotime($record['modifiedtime']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          \strlen($cardData),

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $card['id'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if ('OSSEmployees' == $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cartInstance = \App\Integrations\Dav\Card::loadFromContent($card['carddata']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if ('Contacts' == $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $cartInstance = \App\Integrations\Dav\Card::loadFromContent($card['carddata']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      \App\Log::trace(__METHOD__ . ' | End');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param Vtiger_Record_Model $record

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param array               $card

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt = $this->pdo->prepare('UPDATE dav_cards SET crmid = ? WHERE id = ?;');

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      ]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function getCrmRecordsToSync($moduleName)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              'vtiger_contactdetails.secondary_email', 'vtiger_contactdetails.jobtitle',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ->innerJoin('vtiger_contactaddress', 'vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          return (new App\Db\Query())->select([

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if ('Contacts' === $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $street,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              if (!empty($record['localnumberb'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return $vcard;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel2a'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $adr2 = ['', '',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $street,

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['country'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->REV = null;

              Line exceeds 120 characters; contains 131 characters
              Open

                      return (new App\Db\Query())->from('dav_cards')->where(['addressbookid' => $this->addressBookId, 'crmid' => $crmid])->one();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $query = 'UPDATE vtiger_ossemployees SET dav_status = ? WHERE ossemployeesid = ?;';

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel5a'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel7a'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if (!empty($adr2)) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Clean for update.

              Line exceeds 120 characters; contains 150 characters
              Open

                      return (new App\Db\Query())->select(['dav_cards.*', 'vtiger_crmentity.modifiedtime', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype'])

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['code'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt->execute([0, $crmid]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * Set card addres.

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['ship_code'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->ADR = null;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function getDavCardsToSync()

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $stmt = $this->pdo->prepare($query);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param string                  $moduleName

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $adr1 = ['', '',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $street .= '/' . $record['localnumberb'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param Sabre\VObject\Component $vcard

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return (new App\Db\Query())->select(['dav_cards.*', 'vtiger_crmentity.modifiedtime', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype'])

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          ->from('dav_cards')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          ->leftJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = dav_cards.crmid')

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param Sabre\VObject\Component $vcard

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              if (!empty($record['localnumbera'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $adr2 = ['', '',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->EMAIL = null;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  protected function markComplete($moduleName, $crmid)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if (!$query) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      } elseif ('OSSEmployees' == $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['ship_city'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if (!empty($adr1)) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return (new App\Db\Query())->from('dav_cards')->where(['addressbookid' => $this->addressBookId, 'crmid' => $crmid])->one();

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          ->where(['dav_cards.addressbookid' => $this->addressBookId]);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $query = 'UPDATE vtiger_contactdetails SET dav_status = ? WHERE contactid = ?;';

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return \Sabre\VObject\Component

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record['addresslevel5b'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel1b'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['street'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['state'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['ship_country'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @return \Sabre\VObject\Component

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   */

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $adr1 = $adr2 = [];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['ship_street'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      return $vcard;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['city'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->add('ADR', $adr1, ['type' => 'WORK']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      $vcard->TEL = null;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel1a'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          return;

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   * @param array                   $record

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel5b'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record['city'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              ];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record['ship_city'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['ship_state'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      if ('Contacts' == $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      } elseif ('OSSEmployees' == $moduleName) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  /**

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          if (!empty($record['addresslevel5a'])) {

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $street = $record['addresslevel8b'] . ' ' . $record['buildingnumberb'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel7b'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                          $vcard->add('ADR', $adr2, ['type' => 'HOME']);

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                   *

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $street = $record['addresslevel8a'] . ' ' . $record['buildingnumbera'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $street .= '/' . $record['localnumbera'];

              Spaces must be used to indent lines; tabs are not allowed
              Open

                                  $record['addresslevel2b'],

              Spaces must be used to indent lines; tabs are not allowed
              Open

                              $adr1 = ['', '',

              Spaces must be used to indent lines; tabs are not allowed
              Open

                      }

              Spaces must be used to indent lines; tabs are not allowed
              Open

                  public function cleanForUpdate(Sabre\VObject\Component $vcard)

              Class name "API_CardDAV_Model" is not in camel caps format
              Open

              class API_CardDAV_Model

              There are no issues that match your filters.

              Category
              Status