File CardDAV.php
has 407 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Api CardDAV Model Class.
*
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';
- Read upRead up
- Exclude checks
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';
- Exclude checks
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;
- Read upRead up
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) {
- Read upRead up
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'])) {
- Read upRead up
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'])) {
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;
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();
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) {
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;
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;
- Read upRead up
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();
- Read upRead up
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) {
- Read upRead up
- Exclude checks
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'])) {
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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([
- Read upRead up
- Exclude checks
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([
- Read upRead up
- Exclude checks
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'])
- Read upRead up
- Exclude checks
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']));
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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());
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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']));
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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__);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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;
}
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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;
}
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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;
}
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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());
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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__);
- Read upRead up
- Exclude checks
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__);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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__);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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.*',
- Read upRead up
- Exclude checks
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'],
- Read upRead up
- Exclude checks
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',
- Read upRead up
- Exclude checks
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')
- Read upRead up
- Exclude checks
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']));
- Read upRead up
- Exclude checks
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'],
- Read upRead up
- Exclude checks
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']);
- Read upRead up
- Exclude checks
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'];
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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'];
- Read upRead up
- Exclude checks
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'])) {
- Read upRead up
- Exclude checks
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'])) {
- Read upRead up
- Exclude checks
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']) {
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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'];
- Read upRead up
- Exclude checks
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);
- Exclude checks
Returning type 0
but syncCrmRecord()
is declared to return string
Open
return $create + $updates;
- Exclude checks
Reference to instance property PRODID
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->PRODID = self::PRODID;
- Exclude checks
Reference to instance property FN
from undeclared class \Sabre\VObject\Component
Open
$vcard->FN = $name;
- Exclude checks
Reference to instance property NOTE
from undeclared class \Sabre\VObject\Component
Open
$vcard->NOTE = $record['description'];
- Exclude checks
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);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("AddressBooks end - CRM >> DAV ({$moduleName}) | create: {$create} | updates: {$updates}", __METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start');
- Exclude checks
Call to method ensureUTF8
from undeclared class \Sabre\DAV\StringUtil
Open
$cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Call to method read
from undeclared class \Sabre\VObject\Reader
Open
$vcard = Sabre\VObject\Reader::read($card['carddata']);
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component
Open
$vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
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 = ?;');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
- Exclude checks
Call to method setCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
App\User::setCurrentUserId($orgUserId);
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->add('NOTE', $record['description']);
- Exclude checks
Call to method serialize
from undeclared class \Sabre\VObject\Component
Open
$cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
- Exclude checks
Reference to instance property N
from undeclared class \Sabre\VObject\Component
Open
$vcard->N = [$record['lastname'], $record['firstname']];
- Exclude checks
Call to method setAttribute
on non-class type false
Open
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Call to method __construct
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard = new Sabre\VObject\Component\VCard();
- Exclude checks
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 (?, ?, ?, ?, ?, ?, ?)');
- Exclude checks
Reference to instance property ORG
from undeclared class \Sabre\VObject\Component
Open
$vcard->ORG = $org;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
- Exclude checks
Reference to instance property ORG
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->ORG = $record['company_name'];
- Exclude checks
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);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
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__);
- Exclude checks
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);
- Exclude checks
Returning type void
but syncCrmRecord()
is declared to return string
Open
return;
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component
Open
$vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
Reference to instance property ORG
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->ORG = $org;
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$orgUserId = App\User::getCurrentUserId();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('AddressBooks start', __METHOD__);
- Exclude checks
Reference to instance property N
from undeclared class \Sabre\VObject\Component
Open
$vcard->N = [$record['last_name'], $record['name']];
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Reference to instance property N
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->N = [$record['lastname'], $record['firstname']];
- Exclude checks
Reference to instance property TITLE
from undeclared class \Sabre\VObject\Component
Open
$vcard->TITLE = $record['jobtitle'];
- Exclude checks
Reference to instance property ORG
from undeclared class \Sabre\VObject\Component
Open
$vcard->ORG = $record['company_name'];
- Exclude checks
Reference to instance property TITLE
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->TITLE = $record['jobtitle'];
- Exclude checks
Call to method ensureUTF8
from undeclared class \Sabre\DAV\StringUtil
Open
$cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
- Exclude checks
Call to method serialize
from undeclared class \Sabre\VObject\Component
Open
$cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
- Exclude checks
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']);
- Exclude checks
Reference to instance property N
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->N = [$record['last_name'], $record['name']];
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component\VCard
Open
$vcard->add('FN', trim($name));
- Exclude checks
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);
- Exclude checks
Call to method prepare
on non-class type false
Open
$stmt = $this->pdo->prepare('DELETE FROM dav_cards WHERE id = ?;');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
- Exclude checks
Returning type false
but createRecord()
is declared to return void
Open
return false;
- Exclude checks
Parameter $vcard
has undeclared type \Sabre\VObject\Component
Open
public function cleanForUpdate(Sabre\VObject\Component $vcard)
- Exclude checks
Reference to instance property ADR
from undeclared class \Sabre\VObject\Component
Open
$vcard->ADR = null;
- Exclude checks
Reference to instance property N
from undeclared class \Sabre\VObject\Component\VCard
Open
if (empty($cartInstance->getVCard()->N) && empty($cartInstance->getVCard()->FN)) {
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
- Exclude checks
Return type of cleanForUpdate()
is undeclared type \Sabre\VObject\Component
Open
public function cleanForUpdate(Sabre\VObject\Component $vcard)
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
return (new App\Db\Query())->from('dav_cards')->where(['addressbookid' => $this->addressBookId, 'crmid' => $crmid])->one();
- Exclude checks
Reference to instance property REV
from undeclared class \Sabre\VObject\Component
Open
$vcard->REV = null;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Reference to instance property TEL
from undeclared class \Sabre\VObject\Component
Open
$vcard->TEL = null;
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component
Open
$vcard->add('ADR', $adr2, ['type' => 'HOME']);
- Exclude checks
Returning type true
but createRecord()
is declared to return void
Open
return true;
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
return (new App\Db\Query())->select([
- Exclude checks
Reference to instance property FN
from undeclared class \Sabre\VObject\Component\VCard
Open
if (empty($cartInstance->getVCard()->N) && empty($cartInstance->getVCard()->FN)) {
- Exclude checks
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__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Parameter $vcard
has undeclared type \Sabre\VObject\Component
Open
public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
- Exclude checks
Return type of setCardAddres()
is undeclared type \Sabre\VObject\Component
Open
public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
- Exclude checks
Reference to instance property EMAIL
from undeclared class \Sabre\VObject\Component
Open
$vcard->EMAIL = null;
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
return (new App\Db\Query())->select([
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace(__METHOD__ . ' | Start Card ID' . $card['id']);
- Exclude checks
Call to method prepare
on non-class type false
Open
$stmt = $this->pdo->prepare($query);
- Exclude checks
Call to method prepare
on non-class type false
Open
$stmt = $this->pdo->prepare('UPDATE dav_cards SET crmid = ? WHERE id = ?;');
- Exclude checks
Call to method prepare
on non-class type false
Open
$stmt = $this->pdo->prepare('UPDATE vtiger_crmentity SET modifiedtime = ? WHERE crmid = ?;');
- Exclude checks
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'])
- Exclude checks
Call to method add
from undeclared class \Sabre\VObject\Component
Open
$vcard->add('ADR', $adr1, ['type' => 'WORK']);
- Exclude checks
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;
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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'];
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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'];
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class API_CardDAV_Model
- Exclude checks
The class API_CardDAV_Model is not named in CamelCase. Open
class API_CardDAV_Model
{
const ADDRESSBOOK_NAME = 'YFAddressBook';
const PRODID = 'YetiForceCRM';
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $log;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\User::setCurrentUserId($userId);
- Exclude checks
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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sync from CRM to DAV.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $this->getCrmRecordsToSync($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$query) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->davUsers as $userId => $user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addressBookId = $user->get('addressbooksid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isPermitted) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const ADDRESSBOOK_NAME = 'YFAddressBook';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $telFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $cache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_OWNER':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $card) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $davUsers = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbConfig = \App\Config::db('base');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function crm2Dav(): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$log .= ' & OSSEmployees: ' . $this->syncCrmRecord('OSSEmployees');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($user->get('sync_carddav')) {
- Exclude checks
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']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const PRODID = 'YetiForceCRM';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var Users_Record_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'OSSEmployees' => ['business_mail' => 'WORK', 'private_mail' => 'HOME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'OSSEmployees' => ['business_phone' => 'WORK', 'private_phone' => 'CELL'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sync from CRM to DAV for one module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$create = $updates = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $user = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool|Users_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Contacts' => ['email' => 'WORK', 'secondary_email' => 'HOME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_OWNER_PERSON':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermitted = (int) $record['smownerid'] === $userId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
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']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$shownerIds = \App\Fields\SharedOwner::getById($record['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$card = $this->getCardDetail($record['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$log = 'Contacts: ' . $this->syncCrmRecord('Contacts');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($record = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$orgUserId = App\User::getCurrentUserId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->createCard($moduleName, $record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $crmRecords = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermitted = \App\Privilege::isPermitted($moduleName, 'DetailView', $record['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$isPermitted = (int) $record['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($record['crmid']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Creating
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $pdo = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Contacts' => ['phone' => 'WORK', 'mobile' => 'CELL'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $addressBookId = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function syncCrmRecord($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_BASED_CREDENTIALS':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $mailFields = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_OWNER_PERSON_GROUP':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sync from DAV to CRM for one user.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function syncAddressBooks(): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $create + $deletes + $updates;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function createCard($moduleName, $record)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('FN', trim($name));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard = $this->cleanForUpdate($vcard);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Updating
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->davUsers as $user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $this->getDavCardsToSync()->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($card = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_OWNER_PERSON':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard = new Sabre\VObject\Component\VCard();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cardUri,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addressBookId,
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
\App\Log::trace("AddressBooks end - CRM >> DAV ({$moduleName}) | create: {$create} | updates: {$updates}", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('AddressBooks start', __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$skipped;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermitted = (int) $card['smownerid'] === $userId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->N = [$record['lastname'], $record['firstname']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' != $org) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Record::isExists($card['crmid']) || !$isPermitted) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Deleting
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Updating
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['jobtitle'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('OSSEmployees' === $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard = $this->setCardAddres($vcard, $moduleName, $record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->PRODID = self::PRODID;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateCard($moduleName, $record, $card);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->user = $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Creating
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_OWNER':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (strtotime($card['modifiedtime']) < $card['lastmodified']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start CRM ID:' . $record['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->N = [$record['last_name'], $record['name']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modifiedtime = strtotime($record['modifiedtime']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$create;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['description'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$etag,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record[$key])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = (int) $this->user->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_OWNER_PERSON_GROUP':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $create + $updates;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function dav2Crm(): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$cache[$userId][$card['crmid']])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$deletes;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->ORG = $record['company_name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('NOTE', $record['description']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt->execute([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $i;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
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']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->deletedCard($card);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Contacts' === $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = $record['firstname'] . ' ' . $record['lastname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$org = vtlib\Functions::getCRMRecordLabel($record['parentid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->telFields[$moduleName] as $key => $val) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cardUri = $record['crmid'] . '.vcf';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$etag = md5($cardData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$updates;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$card['crmid']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$i = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$i += $this->syncAddressBooks();
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
\App\Log::trace("AddressBooks end - DAV >> CRM | create: {$create} | deletes: {$deletes} | updates: {$skipped} | skipped: {$updates}", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record[$key])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->mailFields[$moduleName] as $key => $val) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['crmid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$cache[$userId][$record['crmid']] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->markComplete($moduleName, $record['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addressBookId = $user->get('addressbooksid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$updates;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
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__);
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
$stmt = $this->pdo->prepare('INSERT INTO dav_cards (carddata, uri, lastmodified, addressbookid, size, etag, crmid) VALUES (?, ?, ?, ?, ?, ?, ?)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modifiedtime,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateCard($moduleName, $record, $card)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$create;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\User::setCurrentUserId($orgUserId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->createRecord('Contacts', $card)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateRecord(Vtiger_Record_Model::getInstanceById($card['crmid'], $card['setype']), $card);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->PRODID = self::PRODID;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->ORG = $org;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\strlen($cardData),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$create = $deletes = $updates = $skipped = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isPermitted = \App\Privilege::isPermitted($card['setype'], 'DetailView', $card['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$shownerIds = \App\Fields\SharedOwner::getById($card['crmid']);
- Exclude checks
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;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->TITLE = $record['jobtitle'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Integrations\Dav\Card::addChange($this->addressBookId, $cardUri, 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sync from DAV to CRM.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($this->user->get('sync_carddav')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_BASED_CREDENTIALS':
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
$isPermitted = (int) $card['smownerid'] === $userId || \in_array($userId, \App\Fields\SharedOwner::getById($card['crmid']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = $record['name'] . ' ' . $record['last_name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
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 (?, ?, ?, ?, ?, ?, ?)');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cardData,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard = Sabre\VObject\Reader::read($card['carddata']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = $record['name'] . ' ' . $record['last_name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->N = [$record['last_name'], $record['name']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('TEL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$card['id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new App\Db\Query())->select([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Contacts' === $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$org = vtlib\Functions::getCRMRecordLabel($record['parentid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->TITLE = $record['jobtitle'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->telFields[$moduleName] as $key => $val) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cardData,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['crmid'],
- Exclude checks
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__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
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',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->NOTE = $record['description'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_contactdetails.lastname', 'vtiger_contactdetails.phone', 'vtiger_contactdetails.mobile', 'vtiger_contactdetails.email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_ossemployees.dav_status' => 1, 'vtiger_crmentity.deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCardDetail($crmid)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->N = [$record['lastname'], $record['firstname']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['jobtitle'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start Card ID' . $card['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_contactdetails.parentid', 'vtiger_contactdetails.firstname',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->from('vtiger_contactdetails')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_contactdetails.dav_status' => 1, 'vtiger_crmentity.deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('OSSEmployees' === $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function deletedCard($card)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
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__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function updateIdAndModifiedTime(Vtiger_Record_Model $record, array $card)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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 = ?;');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$etag,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Integrations\Dav\Card::addChange($this->addressBookId, $card['crmid'] . '.vcf', 3);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cartInstance->user = $this->user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_contactdetails.parentid', 'vtiger_contactdetails.firstname',
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
->innerJoin('u_#__multicompany', 'vtiger_ossemployees.multicompanyid = u_#__multicompany.multicompanyid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Integrations\Dav\Card::addChange($this->addressBookId, $card['uri'], 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record = Vtiger_Record_Model::getCleanInstance($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->from('vtiger_ossemployees')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->FN = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record[$key])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->mailFields[$moduleName] as $key => $val) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record[$key])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('EMAIL', $record[$key], ['type' => explode(',', $val)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt->execute([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt = $this->pdo->prepare('DELETE FROM dav_cards WHERE id = ?;');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cartInstance->setValuesForCreateRecord($record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateRecord(Vtiger_Record_Model $record, array $card)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt->execute([
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
->innerJoin('vtiger_contactaddress', 'vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_ossemployees.private_mail', 'vtiger_crmentity.modifiedtime', 'u_#__multicompany.company_name',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('u_#__multicompany', 'vtiger_ossemployees.multicompanyid = u_#__multicompany.multicompanyid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->ORG = $record['company_name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $card
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt = $this->pdo->prepare('UPDATE vtiger_crmentity SET modifiedtime = ? WHERE crmid = ?;');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt->execute([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = $record['firstname'] . ' ' . $record['lastname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$etag = md5($cardData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function createRecord(string $moduleName, array $card)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateIdAndModifiedTime($record, $card);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard = $this->setCardAddres($vcard, $moduleName, $record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cartInstance->user = $this->user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($cartInstance->getVCard()->N) && empty($cartInstance->getVCard()->FN)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
'vtiger_contactdetails.lastname', 'vtiger_contactdetails.phone', 'vtiger_contactdetails.mobile', 'vtiger_contactdetails.email',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($org)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->ORG = $org;
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$stmt = $this->pdo->prepare('UPDATE dav_cards SET carddata = ?, lastmodified = ?, size = ?, etag = ?, crmid = ? WHERE id = ?;');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$card['id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Record_Model $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
date('Y-m-d H:i:s', $card['lastmodified']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cardData = Sabre\DAV\StringUtil::ensureUTF8($vcard->serialize());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modifiedtime,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt->execute([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateIdAndModifiedTime($record, $card);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $card
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cartInstance->setValuesForRecord($record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update ID and modified time.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_crmentity.modifiedtime', 'vtiger_contactaddress.*',
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
'vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_ossemployees.name', 'vtiger_ossemployees.last_name',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_ossemployees.business_phone', 'vtiger_ossemployees.private_phone', 'vtiger_ossemployees.business_mail',
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
'vtiger_ossemployees.business_phone', 'vtiger_ossemployees.private_phone', 'vtiger_ossemployees.business_mail',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['description'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modifiedtime = strtotime($record['modifiedtime']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\strlen($cardData),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | Start Card ID:' . $card['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$card['id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('OSSEmployees' == $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cartInstance = \App\Integrations\Dav\Card::loadFromContent($card['carddata']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Contacts' == $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cartInstance = \App\Integrations\Dav\Card::loadFromContent($card['carddata']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace(__METHOD__ . ' | End');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Record_Model $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $card
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt = $this->pdo->prepare('UPDATE dav_cards SET crmid = ? WHERE id = ?;');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCrmRecordsToSync($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'vtiger_contactdetails.secondary_email', 'vtiger_contactdetails.jobtitle',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_contactaddress', 'vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new App\Db\Query())->select([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Contacts' === $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$street,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['localnumberb'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $vcard;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel2a'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$adr2 = ['', '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$street,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['country'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->REV = null;
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
return (new App\Db\Query())->from('dav_cards')->where(['addressbookid' => $this->addressBookId, 'crmid' => $crmid])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = 'UPDATE vtiger_ossemployees SET dav_status = ? WHERE ossemployeesid = ?;';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel5a'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel7a'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($adr2)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Clean for update.
- Exclude checks
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'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['code'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt->execute([0, $crmid]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set card addres.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['ship_code'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->ADR = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDavCardsToSync()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stmt = $this->pdo->prepare($query);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$adr1 = ['', '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$street .= '/' . $record['localnumberb'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Sabre\VObject\Component $vcard
- Exclude checks
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'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('dav_cards')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = dav_cards.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Sabre\VObject\Component $vcard
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['localnumbera'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$adr2 = ['', '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->EMAIL = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function markComplete($moduleName, $crmid)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$query) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('OSSEmployees' == $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['ship_city'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($adr1)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
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();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['dav_cards.addressbookid' => $this->addressBookId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = 'UPDATE vtiger_contactdetails SET dav_status = ? WHERE contactid = ?;';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \Sabre\VObject\Component
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['addresslevel5b'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel1b'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['street'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['state'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['ship_country'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \Sabre\VObject\Component
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$adr1 = $adr2 = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['ship_street'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $vcard;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['city'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('ADR', $adr1, ['type' => 'WORK']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->TEL = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel1a'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel5b'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['city'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['ship_city'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['ship_state'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Contacts' == $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('OSSEmployees' == $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setCardAddres(Sabre\VObject\Component $vcard, $moduleName, $record)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($record['addresslevel5a'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$street = $record['addresslevel8b'] . ' ' . $record['buildingnumberb'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel7b'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vcard->add('ADR', $adr2, ['type' => 'HOME']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$street = $record['addresslevel8a'] . ' ' . $record['buildingnumbera'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$street .= '/' . $record['localnumbera'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record['addresslevel2b'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$adr1 = ['', '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function cleanForUpdate(Sabre\VObject\Component $vcard)
- Exclude checks
Class name "API_CardDAV_Model" is not in camel caps format Open
class API_CardDAV_Model
- Exclude checks