YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Dav/models/Module.php

Summary

Maintainability
A
1 hr
Test Coverage
F
51%

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')
Severity: Minor
Found in modules/Settings/Dav/models/Module.php - About 1 hr to fix

    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();

    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();

    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);

    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)')])

    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]);

    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)')])

    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)')])

    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);
        }

    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)')])

    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);

    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]);

    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);

    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);

    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');

    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();

    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');

    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();

    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')

    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]);

    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'),

    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', [

    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);

    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)')])

    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();

    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]);

    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, [
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    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)')])
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

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

                'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Returning type string but addKey() is declared to return int
    Open

            return $key;
    Severity: Minor
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to method getInstance from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
    Open

                'key' => App\Encryption::getInstance()->encrypt($key),
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

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

                'calendar' => (new App\Db\Query())->select(['calendarid', 'num' => new yii\db\Expression('COUNT(id)')])
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

            $result = $db->createCommand()->insert('dav_users', [
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->update('vtiger_activity', ['dav_status' => 1])->execute();
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->update('vtiger_ossemployees', ['dav_status' => 1])->execute();
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

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

            $query->select(['id'])
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

            $db->createCommand()->insert('dav_principals', [
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->update('vtiger_contactdetails', ['dav_status' => 1])->execute();
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

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

            $uri = (new \App\Db\Query())->select(['uri'])->from('dav_principals')->where(['userid' => $userId]);
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    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)')])
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

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

            if ($query->exists()) {
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    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);

    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');
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Db::getMasterPdo
    Open

            $pdo = $db->getMasterPdo();
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    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);

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

            $calendarId = (new \App\Db\Query())->select(['calendarid'])->from('dav_calendarinstances')->where(['principaluri' => $uri]);
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Integrations\Dav\Backend\Card::createAddressBook
    Open

                $cardDavBackend->createAddressBook('principals/' . $userModel->get('user_name'), API_CardDAV_Model::ADDRESSBOOK_NAME, [
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    Call to undeclared method \App\Db::createCommand
    Open

            $dbCommand = App\Db::getInstance()->createCommand();
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    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);
    Severity: Critical
    Found in modules/Settings/Dav/models/Module.php by phan

    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

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

            $db = App\Db::getInstance();

    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();

    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')

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

                    ->groupBy('addressbookid')

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

            $query->select(['id'])

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

            $digesta1 = md5($userModel->get('user_name') . ':YetiDAV:' . $key);

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

            $db = App\Db::getInstance();

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

                'digesta1' => $digesta1,

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

                'key' => App\Encryption::getInstance()->encrypt($key),

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

        {

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

        public function getAllKeys()

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

        }

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

                return 1;

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

                'userid' => $userID,

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

                    ->groupBy('calendarid')

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

         * Function to add key.

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

        public function addKey($type, $userID)

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

            return [

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

         */

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

            return API_DAV_Model::getAllUser();

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

         * @return int

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

            $query = new App\Db\Query();

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

                ->where(['userid' => $userID]);

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

                'username' => $userModel->get('user_name'),

    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)')])

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

        /**

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

                ->from('dav_users')

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

            $userModel = Users_Record_Model::getInstanceById($userID, 'Users');

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

                    ->createCommand()->queryAllByGroup(),

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

         * @param string[] $type

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

            }

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

            ];

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

         *

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

        public function getAmountData()

    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)')])

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

         * @param int      $userID

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

                    ->createCommand()->queryAllByGroup(),

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

        }

    Line exceeds 120 characters; contains 121 characters
    Open

                'addressbook' => (new App\Db\Query())->select(['addressbookid', 'num' => new yii\db\Expression('COUNT(id)')])

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

            $key = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $keyLength);

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

                'email' => $userModel->get('email1'),

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

                    '{DAV:}displayname' => API_CalDAV_Model::CALENDAR_NAME,

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

                ]);

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

                $db->createCommand()->update('vtiger_contactdetails', ['dav_status' => 1])->execute();

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

            $userName = App\User::getUserModel($userId)->getDetail('user_name');

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

         * @param int $userId

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

                    ->from('dav_calendarobjects')

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

            if ($query->exists()) {

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

            $keyLength = 10;

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

                'displayname' => $displayname,

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

            }

    Line exceeds 120 characters; contains 132 characters
    Open

            $calendarId = (new \App\Db\Query())->select(['calendarid'])->from('dav_calendarinstances')->where(['principaluri' => $uri]);

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

            $dbCommand->delete('dav_calendarinstances', ['principaluri' => $uri])->execute();

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

            $dbCommand->delete('dav_addressbooks', ['principaluri' => $uri])->execute();

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

            vtlib\Functions::recurseDelete($davStorageDir . '/' . $userName);

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

        {

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

         *

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

        {

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

            $result = $db->createCommand()->insert('dav_users', [

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

            $displayname = $userModel->getName();

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

                $calendarBackend->createCalendar('principals/' . $userModel->get('user_name'), API_CalDAV_Model::CALENDAR_NAME, [

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

            return $key;

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

         * @param int $userId

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

            $dbCommand = App\Db::getInstance()->createCommand();

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

            return ['CalDav', 'CardDav', 'WebDav'];

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

        /**

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

         */

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

                return 0;

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

                'uri' => 'principals/' . $userModel->get('user_name'),

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

                $this->createUserDirectory($userID);

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

            $dbCommand->delete('dav_principals', ['userid' => $userId])->execute();

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

        }

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

            if (\in_array('CardDav', $type)) {

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

                $cardDavBackend = new \App\Integrations\Dav\Backend\Card($pdo);

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

         * Function to delete key.

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

            $davStorageDir = App\Config::main('davStorageDir');

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

        {

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

            $pdo = $db->getMasterPdo();

    Line exceeds 120 characters; contains 125 characters
    Open

                $calendarBackend->createCalendar('principals/' . $userModel->get('user_name'), API_CalDAV_Model::CALENDAR_NAME, [

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

            }

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

            $uri = (new \App\Db\Query())->select(['uri'])->from('dav_principals')->where(['userid' => $userId]);

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

        public function createUserDirectory($userId)

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

            }

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

                ]);

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

        {

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

         *

    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);

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

            $db->createCommand()->insert('dav_principals', [

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

        }

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

        /**

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

            $dbCommand->delete('dav_calendars', ['id' => $calendarId])->execute();

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

        }

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

                $cardDavBackend->createAddressBook('principals/' . $userModel->get('user_name'), API_CardDAV_Model::ADDRESSBOOK_NAME, [

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

                $db->createCommand()->update('vtiger_ossemployees', ['dav_status' => 1])->execute();

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

         *

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

         * Create directory for WebDav.

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

        {

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

        }

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

            ])->execute();

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

            if (\in_array('CalDav', $type)) {

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

            }

    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]);

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

            $dbCommand->delete('dav_users', ['userid' => $userId])->execute();

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

            ])->execute();

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

        public function deleteKey($userId)

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

            if (!$result) {

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

                'userid' => $userID,

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

                $calendarBackend = new \App\Integrations\Dav\Backend\Calendar($pdo);

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

                $db->createCommand()->update('vtiger_activity', ['dav_status' => 1])->execute();

    Line exceeds 120 characters; contains 131 characters
    Open

                $cardDavBackend->createAddressBook('principals/' . $userModel->get('user_name'), API_CardDAV_Model::ADDRESSBOOK_NAME, [

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

                    '{DAV:}displayname' => API_CardDAV_Model::ADDRESSBOOK_NAME,

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

            if (\in_array('WebDav', $type)) {

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

         */

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

        public function getTypes()

    Line exceeds 120 characters; contains 132 characters
    Open

            @mkdir(App\Config::main('davStorageDir') . '/' . App\User::getUserModel($userId)->getDetail('user_name') . '/', 0777, true);

    Class name "Settings_Dav_Module_Model" is not in camel caps format
    Open

    class Settings_Dav_Module_Model extends Settings_Vtiger_Module_Model

    There are no issues that match your filters.

    Category
    Status