YetiForceCompany/YetiForceCRM

View on GitHub
modules/Import/models/Module.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
0%

Function getListTplForXmlType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getListTplForXmlType($moduleName)
    {
        $output = [];
        $path = 'modules/Import/tpl/';
        if (is_dir($path)) {
Severity: Minor
Found in modules/Import/models/Module.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Consider simplifying this complex logical expression.
Open

                if ($moduleField->isActiveField() &&
                    'vtiger_entity_stats' !== $moduleField->getTableName() &&
                    !\in_array($moduleField->getColumnName(), ['modifiedby', 'modifiedtime']) &&
                    !\in_array($moduleField->getUIType(), [70, 4]) &&
                    0 !== strcasecmp($moduleField->getFieldDataType(), 'autogenerated') &&
Severity: Major
Found in modules/Import/models/Module.php - About 40 mins to fix

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

        public function getFields($blockInstance = false)
        {
            if (empty($this->fields)) {
                $moduleModel = $this->getImportModuleModel();
                $this->fields = [];
    Severity: Minor
    Found in modules/Import/models/Module.php - About 35 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    class Import_Module_Model extends Vtiger_Module_Model
    {
        /**
         * Import table prefix.
         *
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

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

    Example

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

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

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

                return (new \App\Db\Query())->from($tableName)->where(['temp_status' => Import_Data_Action::IMPORT_RECORD_NONE])->exists();
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

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

                $list = new DirectoryIterator($path);
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    The method getFields has a boolean flag argument $blockInstance, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getFields($blockInstance = false)
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

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

            } else {
                $url = $this->getImportModuleModel()->getListViewUrl();
            }
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Relation_Model' in method 'getUrl'.
    Open

            if ($this->get('relationId') && $this->get('src_record') && $relationModel = Vtiger_Relation_Model::getInstanceById($this->get('relationId'))) {
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'vtlib\Utils' in method 'isUserImportBlocked'.
    Open

            if (vtlib\Utils::checkTable($tableName)) {
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Db' in method 'clearUserImportInfo'.
    Open

            $db = \App\Db::getInstance();
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid assigning values to variables in if clauses and the like (line '312', column '63').
    Open

        public function getUrl()
        {
            if ($this->get('relationId') && $this->get('src_record') && $relationModel = Vtiger_Relation_Model::getInstanceById($this->get('relationId'))) {
                $url = $relationModel->getListUrl(Vtiger_Record_Model::getInstanceById($this->get('src_record')));
            } else {
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

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

    Avoid assigning values to variables in if clauses and the like (line '169', column '7').
    Open

        public static function getFileReader(App\Request $request, App\User $user)
        {
            $type = $request->get('type');
            if ($componentName = static::$componentReader[$type]) {
                $modelClassName = Vtiger_Loader::getComponentClassName('Reader', $componentName, 'Import');
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

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

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

            } else {
                $tableName .= $user->id;
            }
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Import_Queue_Action' in method 'clearUserImportInfo'.
    Open

            Import_Queue_Action::removeForUser($user);
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Import_Lock_Action' in method 'clearUserImportInfo'.
    Open

            Import_Lock_Action::unLock($user);
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Module_Model' in method 'getImportModuleModel'.
    Open

            return $this->importModuleModel = Vtiger_Module_Model::getInstance($this->getImportModule());
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                $url = $relationModel->getListUrl(Vtiger_Record_Model::getInstanceById($this->get('src_record')));
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Loader' in method 'getFileReader'.
    Open

                $modelClassName = Vtiger_Loader::getComponentClassName('Reader', $componentName, 'Import');
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid unused parameters such as '$blockInstance'.
    Open

        public function getFields($blockInstance = false)
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Returning type array{,:'comma',;:'semicolon'} but getSupportedDelimiters() is declared to return \type
    Open

            return self::$supportedDelimiters;
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

    Doc-block of $moduleName in getSupportedFileExtensions is phpdoc param type string which is not a permitted replacement of the nullable param type ?string declared in the signature ('?T' should be documented as 'T|null' or '?T')
    Open

         * @param string $moduleName
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

    Return type of getSupportedDelimiters() is undeclared type \type
    Open

        public static function getSupportedDelimiters()
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

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

                return (new \App\Db\Query())->from($tableName)->where(['temp_status' => Import_Data_Action::IMPORT_RECORD_NONE])->exists();
    Severity: Critical
    Found in modules/Import/models/Module.php by phan

    Argument 2 (needle) is \type but \strpos() takes int|string
    Open

                        if (0 === strpos($fileName, $moduleName)) {
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

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

                    $db->createCommand()->dropTable($table)->execute();
    Severity: Critical
    Found in modules/Import/models/Module.php by phan

    Return type of getSupportedFileEncoding() is undeclared type \type
    Open

        public static function getSupportedFileEncoding()
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

    Returning type array{UTF-8:'UTF-8',ISO-8859-1:'ISO-8859-1',Windows-1250:'Windows-1250',Windows-1251:'Windows-1251',Windows-1252:'Windows-1252',Windows-1253:'Windows-1253',Windows-1254:'Windows-1254',Windows-1255:'Windows-1255',Windows-1256:'Windows-1256',Windows-1257:'Windows-1257',Windows-1258:'Windows-1258'} but getSupportedFileEncoding() is declared to return \type
    Open

            return self::$supportedFileEncoding;
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

    Returning type null but getFileReader() is declared to return \Import_FileReader_Reader
    Open

            return null;
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

    Parameter $moduleName has undeclared type \type
    Open

        public static function getListTplForXmlType($moduleName)
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

    Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
    Open

        public static function getFileReader(App\Request $request, App\User $user)
    Severity: Minor
    Found in modules/Import/models/Module.php by phan

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

                if (!empty($db->getTableSchema($table, true))) {
    Severity: Critical
    Found in modules/Import/models/Module.php by phan

    Avoid excessively long variable names like $supportedFileExtensions. Keep variable name length under 20.
    Open

        public static $supportedFileExtensions = ['csv', 'vcf', 'ical', 'xml', 'ics'];
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

    Avoid excessively long variable names like $supportedFileExtensionsByModule. Keep variable name length under 20.
    Open

        public static $supportedFileExtensionsByModule = ['Contacts' => ['csv', 'vcf', 'xml', 'zip'], 'Calendar' => ['csv', 'ical', 'ics', 'xml'], 'Default' => ['csv', 'xml', 'zip']];
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

    Avoid excessively long variable names like $supportedFileEncoding. Keep variable name length under 20.
    Open

        public static $supportedFileEncoding = [
            'UTF-8' => 'UTF-8',
            'ISO-8859-1' => 'ISO-8859-1',
            'Windows-1250' => 'Windows-1250',
            'Windows-1251' => 'Windows-1251',
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

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

    class Import_Module_Model extends Vtiger_Module_Model

    The class Import_Module_Model is not named in CamelCase.
    Open

    class Import_Module_Model extends Vtiger_Module_Model
    {
        /**
         * Import table prefix.
         *
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

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

            $db = \App\Db::getInstance();
    Severity: Minor
    Found in modules/Import/models/Module.php by phpmd

    ShortVariable

    Since: 0.2

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

    Example

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

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

    Terminating statement must be indented to the same level as the CASE body
    Open

                        return self::$supportedFileExtensionsByModule[$moduleName];

    Terminating statement must be indented to the same level as the CASE body
    Open

                        return self::$supportedFileExtensionsByModule['Default'];

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

         *

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

         * @var array

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

            'xml' => 'XmlReader',

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

            'ISO-8859-1' => 'ISO-8859-1',

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

        /**

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

            'default' => 'FileReader',

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

        public static $supportedFileEncoding = [

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

         * @var string

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

         * @var int

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

            'ics' => 'ICSReader',

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

        const AUTO_MERGE_EXISTINGISPRIORITY = 4;

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

         */

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

         * Auto marge state.

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

            'zip' => 'ZipReader',

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

            'Windows-1252' => 'Windows-1252',

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

            'ical' => 'ICSReader',

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

            'Windows-1254' => 'Windows-1254',

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

            'Windows-1255' => 'Windows-1255',

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

        const IMPORT_TABLE_PREFIX = 'u_yf_import_';

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

        const AUTO_MERGE_NONE = 0;

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

            'csv' => 'CSVReader',

    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

            'Windows-1250' => 'Windows-1250',

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

            'Windows-1253' => 'Windows-1253',

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

         * Import table prefix.

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

         * Components name.

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

        public static $componentReader = [

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

            'vcf' => 'VCardReader',

    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

        const AUTO_MERGE_IGNORE = 1;

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

        const AUTO_MERGE_MERGEFIELDS = 3;

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

            'UTF-8' => 'UTF-8',

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

         */

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

            'Windows-1251' => 'Windows-1251',

    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

        const AUTO_MERGE_OVERWRITE = 2;

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

         * @return array

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

                    default:

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

            foreach ($supportedFileTypes as $fileType) {

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

                self::AUTO_MERGE_IGNORE => 'Skip',

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

         * @return array

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

            return null;

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

                $this->fields = [];

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

        public static $supportedFileExtensionsByModule = ['Contacts' => ['csv', 'vcf', 'xml', 'zip'], 'Calendar' => ['csv', 'ical', 'ics', 'xml'], 'Default' => ['csv', 'xml', 'zip']];

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

         * @param string $moduleName

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

            $output = [];

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

            if (is_dir($path)) {

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

        public static function getFileReader(App\Request $request, App\User $user)

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

                        !\in_array($moduleField->getUIType(), [70, 4]) &&

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

                        0 !== strcasecmp($moduleField->getFieldDataType(), 'autogenerated') &&

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

                    }

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

                    case 'Contacts':

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

            return implode(', ', $description);

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

        public static function getSupportedFileEncoding()

    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

            if ($componentName = static::$componentReader[$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

                foreach ($moduleModel->getFields() as $moduleField) {

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

         * @return type

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

         * @return type

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

        public static function getSupportedDelimiters()

    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 static $supportedDelimiters = [',' => 'comma', ';' => 'semicolon'];

    Line exceeds 120 characters; contains 179 characters
    Open

        public static $supportedFileExtensionsByModule = ['Contacts' => ['csv', 'vcf', 'xml', 'zip'], 'Calendar' => ['csv', 'ical', 'ics', 'xml'], 'Default' => ['csv', 'xml', 'zip']];

    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

                self::AUTO_MERGE_OVERWRITE => 'Overwrite',

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

         *

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

            'Windows-1257' => 'Windows-1257',

    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 self::$supportedDelimiters;

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

                self::AUTO_MERGE_EXISTINGISPRIORITY => 'LBL_FILL_EMPTY'

    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

                        0 !== strcasecmp($moduleField->getFieldDataType(), 'id')) {

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

         * Set import module name.

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

                $description[] = '.' . strtoupper($fileType);

    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

            $type = $request->get('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

         * @param string $moduleName

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

        /**

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

         */

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

        }

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

                $modelClassName = Vtiger_Loader::getComponentClassName('Reader', $componentName, 'Import');

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

         * @param mixed $blockInstance

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

         * @return Vtiger_Field_Model[] - list of field models

    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 $importModule;

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

        public $importModuleModel;

    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 self::$supportedFileExtensionsByModule[$moduleName];

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

        /**

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

            return $output;

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

        }

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

         * @param \App\User    $user

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

        {

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

         *

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

            'Windows-1256' => 'Windows-1256',

    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 self::$supportedFileExtensions;

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

                        return self::$supportedFileExtensionsByModule['Default'];

    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

        public static function getListTplForXmlType($moduleName)

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

                    if (!$singleFile->isDot()) {

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

                        if (0 === strpos($fileName, $moduleName)) {

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

                    }

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

         *

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

            if (empty($this->fields)) {

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

         * @return $this

    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

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

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

        ];

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

         * @param string $moduleName

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

                    case 'Calendar':

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

        public static function getSupportedFileExtensionsDescription($moduleName)

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

            $supportedFileTypes = self::getSupportedFileExtensions($moduleName);

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

        /**

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

        {

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

        {

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

                        }

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

         * Function that returns all the fields for the module.

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

         *

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

                $moduleModel = $this->getImportModuleModel();

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

            return $this;

    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 (vtlib\Utils::checkTable($tableName)) {

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

            'Windows-1258' => 'Windows-1258',

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

         *

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

            $description = [];

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

         *

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

        }

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

                self::AUTO_MERGE_MERGEFIELDS => 'Merge',

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

        }

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

         * Function returns list of templates to import.

    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 (!$moduleName) {

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

            switch ($moduleName) {

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

         *

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

         */

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

            $path = 'modules/Import/tpl/';

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

                        $fileName = $singleFile->getFilename();

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

                return new $modelClassName($request, $user);

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

        public function getFields($blockInstance = false)

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

                        !\in_array($moduleField->getColumnName(), ['modifiedby', 'modifiedtime']) &&

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

                }

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

        /**

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

        /**

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

        }

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

         *

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

         * @param type $moduleName

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

                $list = new DirectoryIterator($path);

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

                    if ($moduleField->isActiveField() &&

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

                        'vtiger_entity_stats' !== $moduleField->getTableName() &&

    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 static function getDbTableName($user)

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

         * Function returns name of the table to import for data from advanced block.

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

            $tableName = self::getDbTableName($user);

    Line exceeds 120 characters; contains 135 characters
    Open

                return (new \App\Db\Query())->from($tableName)->where(['temp_status' => Import_Data_Action::IMPORT_RECORD_NONE])->exists();

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

        }

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

            Import_Lock_Action::unLock($user);

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

         * @return string

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

            if ($this->get('relationId') && $this->get('src_record') && $relationModel = Vtiger_Relation_Model::getInstanceById($this->get('relationId'))) {

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

         *

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

         * @return string

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

         * Function returns supported extensions.

    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 static function getAutoMergeTypes()

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

                            $output[] = $fileName;

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

         * Get file reader.

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

            return $this->fields;

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

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

                return $this->importModuleModel;

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

         * @return bool

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

            Import_Queue_Action::removeForUser($user);

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

            }

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

         * Function returns instance of the module where import takes place.

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

         */

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

            } elseif (method_exists($user, 'getId')) {

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

        /**

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

         */

    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 static $supportedFileExtensions = ['csv', 'vcf', 'ical', 'xml', 'ics'];

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

         * Function returns supported extensions.

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

        public static function getSupportedFileExtensions(?string $moduleName = null)

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

         * Function returns supported extensions.

    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 self::$supportedFileEncoding;

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

         * Get supported delimiters.

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

                foreach ($list as $singleFile) {

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

                }

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

            }

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

         * @param \App\Request $request

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

         * @return \Import_FileReader_Reader

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

                        $this->fields[$moduleField->get('name')] = $moduleField;

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

        public function setImportModule($moduleName)

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

            $this->importModule = $moduleName;

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

         *

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

        public function getImportModule()

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

            return $this->importModuleModel = Vtiger_Module_Model::getInstance($this->getImportModule());

    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

         * Function checks if import is blocked for user.

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

         *

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

         *

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

            foreach ($tables as $table) {

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

                    $db->createCommand()->dropTable($table)->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

        {

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

            if (is_numeric($user)) {

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

                $tableName .= $user->getId();

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

                $tableName .= $user->id;

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

            }

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

            return $tableName;

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

         * @param mixed $user

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

            $tables = [self::getInventoryDbTableName($user), self::getDbTableName($user)];

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

        }

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

        /**

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

         */

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

            $tableName = self::IMPORT_TABLE_PREFIX;

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

        /**

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

                if (!empty($db->getTableSchema($table, true))) {

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

            }

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

         * Get callback url.

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

        public function getUrl()

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

                $url = $relationModel->getListUrl(Vtiger_Record_Model::getInstanceById($this->get('src_record')));

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

        }

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

         *

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

         * @return Vtiger_Module_Model

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

            if ($this->importModuleModel) {

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

         *

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

         * @return string

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

            } else {

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

            return self::getDbTableName($user) . '_inv';

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

        public static function isUserImportBlocked($user)

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

        {

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

                $url = $this->getImportModuleModel()->getListViewUrl();

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

        /**

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

         * @param mixed $user

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

        }

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

        public static function clearUserImportInfo($user)

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

                }

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

            } else {

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

        /**

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

         * Function returns name of the table to import.

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

            }

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

         * Function clears data related to import of records by user.

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

         */

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

        {

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

        }

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

         * Function returns module name where import takes place.

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

                $tableName .= $user;

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

         * @return string

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

        {

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

        }

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

        {

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

         * @param mixed $user

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

         */

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

        public static function getInventoryDbTableName($user)

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

            return false;

    Line exceeds 120 characters; contains 152 characters
    Open

            if ($this->get('relationId') && $this->get('src_record') && $relationModel = Vtiger_Relation_Model::getInstanceById($this->get('relationId'))) {

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

        }

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

         *

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

                return (new \App\Db\Query())->from($tableName)->where(['temp_status' => Import_Data_Action::IMPORT_RECORD_NONE])->exists();

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

         *

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

         * @param mixed $user

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

            return $url;

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

         * @return string

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

            return $this->importModule;

    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

         */

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

    class Import_Module_Model extends Vtiger_Module_Model

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    case 'Calendar':

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    case 'Contacts':

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    default:

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Closing brace indented incorrectly; expected 8 spaces, found 12
    Open

                }

    There are no issues that match your filters.

    Category
    Status