Method addKey
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addKey($type, $userID)
{
$query = new App\Db\Query();
$query->select(['id'])
->from('dav_users')
The class Settings_Dav_Module_Model has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class Settings_Dav_Module_Model extends Settings_Vtiger_Module_Model
{
public function getAllKeys()
{
return API_DAV_Model::getAllUser();
- 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 '40', column '16'). Open
$query = new App\Db\Query();
- 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 '70', column '27'). Open
$calendarBackend = new \App\Integrations\Dav\Backend\Calendar($pdo);
- 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 '19', column '75'). Open
'calendar' => (new App\Db\Query())->select(['calendarid', 'num' => new yii\db\Expression('COUNT(id)')])
- 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 '98', column '22'). Open
$calendarId = (new \App\Db\Query())->select(['calendarid'])->from('dav_calendarinstances')->where(['principaluri' => $uri]);
- 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 '19', column '23'). Open
'calendar' => (new App\Db\Query())->select(['calendarid', 'num' => new yii\db\Expression('COUNT(id)')])
- 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 '23', column '26'). Open
'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])
- 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
Remove error control operator '@' on line 122. Open
public function createUserDirectory($userId)
{
@mkdir(App\Config::main('davStorageDir') . '/' . App\User::getUserModel($userId)->getDetail('user_name') . '/', 0777, true);
}
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '23', column '81'). Open
'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])
- 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 '77', column '26'). Open
$cardDavBackend = new \App\Integrations\Dav\Backend\Card($pdo);
- 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 '97', column '15'). Open
$uri = (new \App\Db\Query())->select(['uri'])->from('dav_principals')->where(['userid' => $userId]);
- 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 'vtlib\Functions' in method 'deleteKey'. Open
vtlib\Functions::recurseDelete($davStorageDir . '/' . $userName);
- 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 'createUserDirectory'. Open
@mkdir(App\Config::main('davStorageDir') . '/' . App\User::getUserModel($userId)->getDetail('user_name') . '/', 0777, true);
- 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 'Users_Record_Model' in method 'addKey'. Open
$userModel = Users_Record_Model::getInstanceById($userID, 'Users');
- 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 'API_DAV_Model' in method 'getAllKeys'. Open
return API_DAV_Model::getAllUser();
- 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 'deleteKey'. Open
$davStorageDir = App\Config::main('davStorageDir');
- 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\Db' in method 'addKey'. Open
$db = App\Db::getInstance();
- 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 "dav_users" 3 times. Open
->from('dav_users')
- 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 "principaluri" 3 times. Open
$calendarId = (new \App\Db\Query())->select(['calendarid'])->from('dav_calendarinstances')->where(['principaluri' => $uri]);
- 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 "principals/" 3 times. Open
'uri' => 'principals/' . $userModel->get('user_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 "dav_principals" 3 times. Open
$db->createCommand()->insert('dav_principals', [
- 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 "user_name" 7 times. Open
$digesta1 = md5($userModel->get('user_name') . ':YetiDAV:' . $key);
- 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 "calendarid" 3 times. Open
'calendar' => (new App\Db\Query())->select(['calendarid', 'num' => new yii\db\Expression('COUNT(id)')])
- 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 "dav_status" 3 times. Open
$db->createCommand()->update('vtiger_activity', ['dav_status' => 1])->execute();
- 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 "userid" 6 times. Open
->where(['userid' => $userID]);
- 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 undeclared method \App\Integrations\Dav\Backend\Calendar::createCalendar
Open
$calendarBackend->createCalendar('principals/' . $userModel->get('user_name'), API_CalDAV_Model::CALENDAR_NAME, [
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])
- Exclude checks
Returning type string
but addKey()
is declared to return int
Open
return $key;
- Exclude checks
Call to method getInstance
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
'key' => App\Encryption::getInstance()->encrypt($key),
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
'calendar' => (new App\Db\Query())->select(['calendarid', 'num' => new yii\db\Expression('COUNT(id)')])
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$result = $db->createCommand()->insert('dav_users', [
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_activity', ['dav_status' => 1])->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_ossemployees', ['dav_status' => 1])->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query->select(['id'])
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('dav_principals', [
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_contactdetails', ['dav_status' => 1])->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$uri = (new \App\Db\Query())->select(['uri'])->from('dav_principals')->where(['userid' => $userId]);
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
'calendar' => (new App\Db\Query())->select(['calendarid', 'num' => new yii\db\Expression('COUNT(id)')])
- Exclude checks
Call to undeclared method \App\Db\Query::exists
Open
if ($query->exists()) {
- Exclude checks
Call with 1 arg(s) to \App\Integrations\Dav\Backend\Calendar::__construct()
which only takes 0 arg(s) defined at /code/app/Integrations/Dav/Backend/Calendar.php:21
Open
$calendarBackend = new \App\Integrations\Dav\Backend\Calendar($pdo);
- Exclude checks
Call to method getUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userName = App\User::getUserModel($userId)->getDetail('user_name');
- Exclude checks
Call to undeclared method \App\Db::getMasterPdo
Open
$pdo = $db->getMasterPdo();
- Exclude checks
Call with 1 arg(s) to \App\Integrations\Dav\Backend\Card::__construct()
which only takes 0 arg(s) defined at /code/app/Integrations/Dav/Backend/Card.php:20
Open
$cardDavBackend = new \App\Integrations\Dav\Backend\Card($pdo);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$calendarId = (new \App\Db\Query())->select(['calendarid'])->from('dav_calendarinstances')->where(['principaluri' => $uri]);
- Exclude checks
Call to undeclared method \App\Integrations\Dav\Backend\Card::createAddressBook
Open
$cardDavBackend->createAddressBook('principals/' . $userModel->get('user_name'), API_CardDAV_Model::ADDRESSBOOK_NAME, [
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = App\Db::getInstance()->createCommand();
- Exclude checks
Call to method getUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
@mkdir(App\Config::main('davStorageDir') . '/' . App\User::getUserModel($userId)->getDetail('user_name') . '/', 0777, true);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Dav_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = App\Db::getInstance();
- 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
The class Settings_Dav_Module_Model is not named in CamelCase. Open
class Settings_Dav_Module_Model extends Settings_Vtiger_Module_Model
{
public function getAllKeys()
{
return API_DAV_Model::getAllUser();
- 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
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
->groupBy('addressbookid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->select(['id'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$digesta1 = md5($userModel->get('user_name') . ':YetiDAV:' . $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'digesta1' => $digesta1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'key' => App\Encryption::getInstance()->encrypt($key),
- 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 getAllKeys()
- 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 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'userid' => $userID,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->groupBy('calendarid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to add key.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addKey($type, $userID)
- 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
return API_DAV_Model::getAllUser();
- 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
$query = new App\Db\Query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['userid' => $userID]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'username' => $userModel->get('user_name'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'calendar' => (new App\Db\Query())->select(['calendarid', 'num' => new yii\db\Expression('COUNT(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
->from('dav_users')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = Users_Record_Model::getInstanceById($userID, 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->queryAllByGroup(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string[] $type
- 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 getAmountData()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userID
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->queryAllByGroup(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $keyLength);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'email' => $userModel->get('email1'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'{DAV:}displayname' => API_CalDAV_Model::CALENDAR_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
$db->createCommand()->update('vtiger_contactdetails', ['dav_status' => 1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userName = App\User::getUserModel($userId)->getDetail('user_name');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('dav_calendarobjects')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($query->exists()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keyLength = 10;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'displayname' => $displayname,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$calendarId = (new \App\Db\Query())->select(['calendarid'])->from('dav_calendarinstances')->where(['principaluri' => $uri]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('dav_calendarinstances', ['principaluri' => $uri])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('dav_addressbooks', ['principaluri' => $uri])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
vtlib\Functions::recurseDelete($davStorageDir . '/' . $userName);
- 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
$result = $db->createCommand()->insert('dav_users', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$displayname = $userModel->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$calendarBackend->createCalendar('principals/' . $userModel->get('user_name'), API_CalDAV_Model::CALENDAR_NAME, [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $key;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['CalDav', 'CardDav', 'WebDav'];
- 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 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uri' => 'principals/' . $userModel->get('user_name'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->createUserDirectory($userID);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('dav_principals', ['userid' => $userId])->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
if (\in_array('CardDav', $type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cardDavBackend = new \App\Integrations\Dav\Backend\Card($pdo);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to delete key.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$davStorageDir = App\Config::main('davStorageDir');
- 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
$pdo = $db->getMasterPdo();
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$calendarBackend->createCalendar('principals/' . $userModel->get('user_name'), API_CalDAV_Model::CALENDAR_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
$uri = (new \App\Db\Query())->select(['uri'])->from('dav_principals')->where(['userid' => $userId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function createUserDirectory($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
{
- 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
@mkdir(App\Config::main('davStorageDir') . '/' . App\User::getUserModel($userId)->getDetail('user_name') . '/', 0777, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('dav_principals', [
- 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
$dbCommand->delete('dav_calendars', ['id' => $calendarId])->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
$cardDavBackend->createAddressBook('principals/' . $userModel->get('user_name'), API_CardDAV_Model::ADDRESSBOOK_NAME, [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_ossemployees', ['dav_status' => 1])->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
* Create directory for WebDav.
- 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
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array('CalDav', $type)) {
- 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
$calendarId = (new \App\Db\Query())->select(['calendarid'])->from('dav_calendarinstances')->where(['principaluri' => $uri]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('dav_users', ['userid' => $userId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function deleteKey($userId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$result) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'userid' => $userID,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$calendarBackend = new \App\Integrations\Dav\Backend\Calendar($pdo);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_activity', ['dav_status' => 1])->execute();
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$cardDavBackend->createAddressBook('principals/' . $userModel->get('user_name'), API_CardDAV_Model::ADDRESSBOOK_NAME, [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'{DAV:}displayname' => API_CardDAV_Model::ADDRESSBOOK_NAME,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array('WebDav', $type)) {
- 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 getTypes()
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
@mkdir(App\Config::main('davStorageDir') . '/' . App\User::getUserModel($userId)->getDetail('user_name') . '/', 0777, true);
- Exclude checks
Class name "Settings_Dav_Module_Model" is not in camel caps format Open
class Settings_Dav_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks