YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMailView/dashboards/Graf.php

Summary

Maintainability
B
6 hrs
Test Coverage
F
0%

Method process has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $userId = \App\User::getCurrentUserId();
        $viewer = $this->getViewer($request);
        $moduleName = $request->getModule();
Severity: Major
Found in modules/OSSMailView/dashboards/Graf.php - About 3 hrs to fix

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

        public function process(App\Request $request)
        {
            $userId = \App\User::getCurrentUserId();
            $viewer = $this->getViewer($request);
            $moduleName = $request->getModule();
    Severity: Minor
    Found in modules/OSSMailView/dashboards/Graf.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    The method process() has 106 lines of code. Current threshold is set to 100. Avoid really long methods.
    Open

        public function process(App\Request $request)
        {
            $userId = \App\User::getCurrentUserId();
            $viewer = $this->getViewer($request);
            $moduleName = $request->getModule();

    The method process() has an NPath complexity of 540. The configured NPath complexity threshold is 200.
    Open

        public function process(App\Request $request)
        {
            $userId = \App\User::getCurrentUserId();
            $viewer = $this->getViewer($request);
            $moduleName = $request->getModule();

    NPathComplexity

    Since: 0.1

    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

    Example

    class Foo {
        function bar() {
            // lots of complicated code
        }
    }

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

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

        public function process(App\Request $request)
        {
            $userId = \App\User::getCurrentUserId();
            $viewer = $this->getViewer($request);
            $moduleName = $request->getModule();

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

        public function process(App\Request $request)

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

    See

    Missing class import via use statement (line '106', column '26').
    Open

            $queryGenerator = (new \App\QueryGenerator($moduleName))

    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 '108', column '38').
    Open

                ->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])

    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 '48', column '14').
    Open

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

    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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $dateFilter['start'] = $today;
                $dateFilter['end'] = $today;
            }

    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

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

                } else {
                    $data = strtotime('last Monday', strtotime($today));
                    $dateFilter['start'] = date('Y-m-d', $data);
                }

    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

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

            } else {
                $viewer->view('dashboards/Graf.tpl', $moduleName);
            }

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Fields\Picklist' in method 'process'.
    Open

            $colors = \App\Fields\Picklist::getValues($fieldName);

    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\Language' in method 'process'.
    Open

                $data['labels'][$i] = \App\Language::translate($row[$fieldName], $moduleName);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Fields\DateTime' in method 'getSearchParams'.
    Open

                $conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];

    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_Widget_Model' in method 'process'.
    Open

            $viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Fields\DateTime' in method 'getSearchParams'.
    Open

                $conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

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

    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\Colors' in method 'process'.
    Open

                $color = !empty($colors[$row[$fieldName]]) ? '#' . $colors[$row[$fieldName]] : \App\Colors::getRandomColor($i);

    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 "start" 10 times.
    Open

                $conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];

    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 "Y-m-d" 12 times.
    Open

            $today = date('Y-m-d');

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

                    $data = strtotime('last Monday', strtotime($today));

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Call to method setFields from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

            $queryGenerator = (new \App\QueryGenerator($moduleName))
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ACCESSIBLE_USERS', $userList);
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Suspicious type void of a variable or expression used to build a string. (Expected type to be able to cast to a string)
    Open

                $dataSets[0]['links'][$i] = $listViewUrl . $this->getSearchParams($row[$fieldName], $owner, $dateFilter);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ACCESSIBLE_GROUPS', $groupList);
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Variable $dateFilter was undeclared, but array fields are being added to it.
    Open

                $dateFilter['start'] = date('Y-m-d', $data);

    Call to method getInstance from undeclared class \Vtiger_Widget_Model
    Open

            $viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('DATA', $data);
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Argument 4 (mon) is string but \mktime() takes int
    Open

                $dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));

    Call to method getInstance from undeclared class \App\Fields\Owner
    Open

            $userList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleUsersForModule();
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    When fetching an array index from a value of type string, found an array index of type 'end', but expected the index to be of type int
    Open

                $conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];

    Variable $dateFilter was undeclared, but array fields are being added to it.
    Open

                $dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));

    Argument 6 (year) is string but \mktime() takes int
    Open

                $dateFilter['end'] = date('Y-m-d', mktime(23, 59, 59, date('m'), 0, date('Y')));

    When fetching an array index from a value of type string, found an array index of type 'start', but expected the index to be of type int
    Open

                $conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];

    Variable $dateFilter was undeclared, but array fields are being added to it.
    Open

                    $dateFilter['start'] = date('Y-m-d', $data);

    Argument 6 (year) is string but \mktime() takes int
    Open

                $dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE_NAME', $moduleName);
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

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

            return '&search_params=' . json_encode([$conditions]);

    Call to method getInstance from undeclared class \App\Fields\Owner
    Open

            $groupList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleGroupForModule();
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Variable $dateFilter was undeclared, but array fields are being added to it.
    Open

                $dateFilter['start'] = date('Y-m-d', $data);

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

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

            $userId = \App\User::getCurrentUserId();
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Variable $dateFilter was undeclared, but array fields are being added to it.
    Open

                $dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));

    Variable $dateFilter was undeclared, but array fields are being added to it.
    Open

                $dateFilter['start'] = $today;

    Call to method __construct from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
    Open

            $queryGenerator = (new \App\QueryGenerator($moduleName))
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Argument 6 (year) is string but \mktime() takes int
    Open

                $dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));

    Argument 4 (mon) is string but \mktime() takes int
    Open

                $dateFilter['end'] = date('Y-m-d', mktime(23, 59, 59, date('m'), 0, date('Y')));

    Call to method __construct from undeclared class \yii\db\Expression
    Open

                ->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])
    Severity: Critical
    Found in modules/OSSMailView/dashboards/Graf.php by phan

    Variable $dateFilter was undeclared, but array fields are being added to it.
    Open

                    $dateFilter['start'] = date('Y-m-d');

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

    class OSSMailView_Graf_Dashboard extends Vtiger_IndexAjax_View

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

            $i = 0;

    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 OSSMailView_Graf_Dashboard is not named in CamelCase.
    Open

    class OSSMailView_Graf_Dashboard extends Vtiger_IndexAjax_View
    {
        /**
         * Return params to search.
         *

    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

                $conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];

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

            return '&search_params=' . json_encode([$conditions]);

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

                    $dateFilter['start'] = date('Y-m-d', $data);

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

         * Return params to search.

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

         *

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

            $linkId = $request->getInteger('linkid');

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

                $owner = $userId;

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

                $dateFilter['end'] = date('Y-m-d');

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

                $dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y')));

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

            } elseif ('Previous month' === $dates) {

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

            }

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

                $dateFilter['start'] = date('Y-m-d', $data);

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

            } elseif ('Current month' === $dates) {

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

            $dateFilter['start'] .= ' 00:00:00';

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

                'data' => [],

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

         * @return void

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

            $owner = $request->getByType('owner', 'Alnum');

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

            $today = date('Y-m-d');

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

                $data = strtotime('-1 day', strtotime($today));

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

                    $data = strtotime('last Monday', strtotime(date('Y-m-d', $data)));

    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

            $dataSets = [[

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

         * @param int    $assignedTo

    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 ('all' !== $assignedTo) {

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

                $dateFilter['end'] = $today;

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

                $dateFilter['start'] = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, 1, date('Y')));

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

                $dateFilter['end'] = date('Y-m-d', mktime(23, 59, 59, date('m'), 0, date('Y')));

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

            } elseif ('All' === $dates) {

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

                $dateFilter['start'] = $today;

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

                'backgroundColor' => [],

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

        /**

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

            $groupList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleGroupForModule();

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

            } elseif (is_numeric($owner) && !isset($userList[$owner]) && !isset($groupList[$owner])) {

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

            } elseif ('Previous week' === $dates) {

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

                if ('Mon' != date('D')) {

    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

        /** {@inheritdoc} */

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

        public function process(App\Request $request)

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

                $dateFilter['start'] = date('Y-m-d', $data);

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

                $dateFilter['end'] = date('Y-m-d', $data);

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

                $dateFilter = '';

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

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

                }

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

                $data = strtotime('last Monday', strtotime($today));

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

         * @param string $dates

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

         *

    Line exceeds 120 characters; contains 167 characters
    Open

                $conditions[] = ['createdtime', 'bw', \App\Fields\DateTime::formatToDisplay($dates['start']) . ',' . \App\Fields\DateTime::formatToDisplay($dates['end'])];

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

                $data = strtotime('last Sunday', strtotime($today));

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

                'show_chart' => false,

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

                ->addCondition($fieldName, '', 'ny')

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

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

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

            }

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

                'borderColor' => [],

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

                'links' => []

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

                $color = !empty($colors[$row[$fieldName]]) ? '#' . $colors[$row[$fieldName]] : \App\Colors::getRandomColor($i);

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

                $dataSets[0]['links'][$i] = $listViewUrl . $this->getSearchParams($row[$fieldName], $owner, $dateFilter);

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

            }

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

            $moduleName = $request->getModule();

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

            $userList = \App\Fields\Owner::getInstance($moduleName, $userId)->getAccessibleUsersForModule();

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

            if ('Yesterday' === $dates) {

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

                }

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

                $dateFilter['end'] = $today;

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

                'labels' => [],

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

                $data['show_chart'] = true;

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

            $viewer->assign('WIDGET', Vtiger_Widget_Model::getInstance($linkId, $userId));

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

            $conditions[] = ['ossmailview_sendtype', 'e', $stage];

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

        {

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

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

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

            $dates = $request->getByType('dateFilter', 'Text');

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

            } elseif ('Current week' === $dates) {

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

                    $dateFilter['start'] = date('Y-m-d');

    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

                $dataSets[0]['data'][$i] = $row['count'];

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

                'datasets' => &$dataSets,

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

            $viewer->assign('ACCESSIBLE_GROUPS', $groupList);

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

                $viewer->view('dashboards/DashBoardWidgetContents.tpl', $moduleName);

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

                ++$i;

    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

        public function getSearchParams($stage, $assignedTo, $dates)

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

            $conditions = [];

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

                $conditions[] = ['assigned_user_id', 'e', $assignedTo];

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

            if (!empty($dates)) {

    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 ('Mon' == date('D')) {

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

                    $data = strtotime('last Monday', strtotime($today));

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

                $dateFilter['end'] = date('Y-m-d', $data);

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

                ->setFields([$fieldName])

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

                ->setGroup($fieldName)

    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 $stage

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

            $viewer = $this->getViewer($request);

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

            if (!$owner) {

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

            $dateFilter['end'] .= ' 23:59:59';

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

            if ($request->has('content')) {

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

            ];

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

                ->addCondition('createdtime', $dateFilter['start'] . ',' . $dateFilter['end'], 'bw');

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

            $fieldName = 'ossmailview_sendtype';

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

                ->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])

    Line exceeds 120 characters; contains 123 characters
    Open

                $color = !empty($colors[$row[$fieldName]]) ? '#' . $colors[$row[$fieldName]] : \App\Colors::getRandomColor($i);

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

                $dataSets[0]['backgroundColor'][$i] = $color;

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

            $colors = array_column($colors, 'color', $fieldName);

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

            $listViewUrl = Vtiger_Module_Model::getInstance($moduleName)->getListViewUrl();

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

                $queryGenerator->addCondition('assigned_user_id', $owner, 'e');

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

            }

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

                $data['labels'][$i] = \App\Language::translate($row[$fieldName], $moduleName);

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

                $dataSets[0]['names'][$i] = $row[$fieldName];

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

                $viewer->view('dashboards/Graf.tpl', $moduleName);

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

                'tooltips' => [],

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

            ]];

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

            $queryGenerator = (new \App\QueryGenerator($moduleName))

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

                $dataSets[0]['borderColor'][$i] = $color;

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

            $viewer->assign('ACCESSIBLE_USERS', $userList);

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

            $viewer->assign('DATA', $data);

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

        }

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

                'names' => [],

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

            $data = [

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

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

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

            $colors = \App\Fields\Picklist::getValues($fieldName);

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

            if ('all' !== $owner) {

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

            $i = 0;

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

            $dataReader->close();

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

            $viewer->assign('MODULE_NAME', $moduleName);

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

            }

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

    class OSSMailView_Graf_Dashboard extends Vtiger_IndexAjax_View

    There are no issues that match your filters.

    Category
    Status