YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Workflows/models/TaskRecord.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
0%

Settings_Workflows_TaskRecord_Model has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model
{
    /**
     * Task status active.
     *
Severity: Minor
Found in modules/Settings/Workflows/models/TaskRecord.php - About 2 hrs to fix

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

        public static function getAllForWorkflow(Settings_Workflows_Record_Model $workflowModel, $active = false)
        {
            $tm = new VTTaskManager();
            $tasks = $tm->getTasksForWorkflow($workflowModel->getId(), $active);
            $taskModels = [];
    Severity: Minor
    Found in modules/Settings/Workflows/models/TaskRecord.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

    Class "Settings_Workflows_TaskRecord_Model" has 22 methods, which is greater than 20 authorized. Split it into smaller classes.
    Open

    class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model

    A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

    Missing class import via use statement (line '211', column '13').
    Open

            $tm = new VTTaskManager();

    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 '311', column '15').
    Open

            return (new \App\Db\Query())

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Missing class import via use statement (line '253', column '13').
    Open

            $tm = new VTTaskManager();

    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 getAllForWorkflow has a boolean flag argument $active, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function getAllForWorkflow(Settings_Workflows_Record_Model $workflowModel, $active = false)

    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

    Missing class import via use statement (line '235', column '13').
    Open

            $tm = new VTTaskManager();

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

            } else {
                $taskId = false;
            }

    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 'Settings_Workflows_TaskType_Model' in method 'getTaskType'.
    Open

                    $this->task_type = Settings_Workflows_TaskType_Model::getInstanceFromClassName($taskClass);

    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 'Settings_Workflows_Record_Model' in method 'getInstance'.
    Open

                $workflowModel = Settings_Workflows_Record_Model::getInstance($task->workflowId);

    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 "status" 3 times.
    Open

            return self::TASK_STATUS_ACTIVE == $this->get('status');

    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 "summary" 3 times.
    Open

            return $this->get('summary');

    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.

    Reference to undeclared property \VTTask->id
    Open

                $taskId = $task->id;

    Reference to undeclared property \VTTask->active
    Open

            $status = $task->active;

    Call to undeclared method \Workflow::getParams
    Open

            $workflowModeIterationOff = $this->getWorkflow()->getParams('iterationOff');

    Argument 1 (taskClass) is class-string but \Settings_Workflows_TaskType_Model::getInstanceFromClassName() takes \VTTask defined at /code/modules/Settings/Workflows/models/TaskType.php:77
    Open

                    $this->task_type = Settings_Workflows_TaskType_Model::getInstanceFromClassName($taskClass);

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type (Did you mean $taskType)
    Open

            $this->task_type = $taskType;

    Reference to undeclared property \VTTask->summary
    Open

            $summary = $task->summary;

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
    Open

                    $this->task_type = Settings_Workflows_TaskType_Model::getInstanceFromClassName($taskClass);

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
    Open

            return $this->task_type;

    Returning type \Settings_Workflows_TaskRecord_Model but getInstanceFromTaskObject() is declared to return \VTTask
    Open

            return $taskModel->set('task_id', $taskId)->set('summary', $summary)->set('status', $status)

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_object
    Open

            $this->task_object = $task;

    Reference to undeclared property \VTTask->id
    Open

            if (isset($task->id)) {

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->workflow
    Open

            return $this->workflow;

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->workflow
    Open

            $this->workflow = $workflowModel;

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
    Open

            $this->task_manager->saveTask($taskObject);

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
    Open

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

    Call to undeclared method \VTTask::isEditable
    Open

                    if (!$active || $taskRecord->isEditable()) {

    Argument 2 (workflowModel) is \App\Base|\Settings_Vtiger_Record_Model|\Settings_Workflows_Record_Model but \Settings_Workflows_TaskRecord_Model::getInstanceFromTaskObject() takes \Workflow defined at /code/modules/Settings/Workflows/models/TaskRecord.php:266
    Open

                    $taskRecord = self::getInstanceFromTaskObject($task, $workflowModel, $tm);

    Reference to undeclared property \VTTask->summary
    Open

            $this->set('summary', $taskObject->summary)->set('status', $taskObject->active);

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
    Open

            return $this->task_manager;

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
    Open

            $url = 'index.php?module=Workflows&parent=Settings&view=EditTask&type=' . $this->task_type->getName() . '&for_workflow=' . $this->getWorkflow()->getId();

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_object
    Open

            return $this->task_object;

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
    Open

            $this->task_manager->deleteTask($this->getId());

    Reference to undeclared property \VTTask->active
    Open

            $this->set('summary', $taskObject->summary)->set('status', $taskObject->active);

    Reference to undeclared property \VTTask->workflowId
    Open

                $workflowModel = Settings_Workflows_Record_Model::getInstance($task->workflowId);

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

            return (new \App\Db\Query())

    Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
    Open

            $this->task_manager = $tm;

    Call to undeclared method \Workflow::getId
    Open

            $url = 'index.php?module=Workflows&parent=Settings&view=EditTask&type=' . $this->task_type->getName() . '&for_workflow=' . $this->getWorkflow()->getId();

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

            $workflowModeIterationOff = $this->getWorkflow()->getParams('iterationOff');

    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 Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 17 and the first side effect is on line 12.
    Open

    <?php

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

            $tm = new VTTaskManager();

    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

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

            $tm = new VTTaskManager();

    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

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

        public static function getInstanceFromTaskObject($task, $workflowModel, $tm)

    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

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

            $tm = new VTTaskManager();

    ShortVariable

    Since: 0.2

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

    Example

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

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

    The class Settings_Workflows_TaskRecord_Model is not named in CamelCase.
    Open

    class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model
    {
        /**
         * Task status active.
         *

    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 $tm. Configured minimum length is 3.
    Open

        public function setTaskManager($tm)

    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

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

        /**

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

         * Task status active.

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

         * @return int

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

        {

    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

         * @var int

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

         * Return task record name.

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

         */

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

            $workflowModeIterationOff = $this->getWorkflow()->getParams('iterationOff');

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

         * @return VTTask

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

            return $this->task_object;

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

         * Set task object.

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

            $this->task_object = $task;

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

         *

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

         */

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

        public function getDeleteActionUrl()

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

            return 'index.php?module=Workflows&parent=Settings&action=TaskAjax&mode=changeStatus&task_id=' . $this->getId();

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

         * @param object $workflowModel

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

        public function setWorkflowFromInstance($workflowModel)

    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

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

    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

            $recordEventMode = $this->getTaskObject()->recordEventState ?? VTTask::RECORD_EVENT_ACTIVE;

    Line exceeds 120 characters; contains 151 characters
    Open

            || (!$workflowModeIterationOff && (VTTask::RECORD_EVENT_DOUBLE_MODE === $recordEventMode || VTTask::RECORD_EVENT_ACTIVE === $recordEventMode));

    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

         * @return VTTaskManager

    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 change status url.

    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 Workflow

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

        {

    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

         * Set task manager object.

    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

            return $this->task_type;

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

            $this->task_type = $taskType;

    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

            || (!$workflowModeIterationOff && (VTTask::RECORD_EVENT_DOUBLE_MODE === $recordEventMode || VTTask::RECORD_EVENT_ACTIVE === $recordEventMode));

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

                $taskObject = $this->getTaskObject();

    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 clean instance.

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

            $taskModel->setTaskManager($tm);

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

         * Function saves workflow task.

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

        public function getName()

    Line exceeds 120 characters; contains 161 characters
    Open

            $url = 'index.php?module=Workflows&parent=Settings&view=EditTask&type=' . $this->task_type->getName() . '&for_workflow=' . $this->getWorkflow()->getId();

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

                $url .= '&task_id=' . $this->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

            return $this->workflow;

    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

            $tm = new VTTaskManager();

    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 (null === $workflowModel) {

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

            return self::getInstanceFromTaskObject($task, $workflowModel, $tm);

    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

            $status = $task->active;

    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 next task action sequence number.

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

        const TASK_STATUS_ACTIVE = 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

            return $this->get('summary');

    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

        }

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

         * Return delete action url.

    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

        /**

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

         */

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

                    $this->task_type = Settings_Workflows_TaskType_Model::getInstanceFromClassName($taskClass);

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

            $taskModels = [];

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

                    if (!$active || $taskRecord->isEditable()) {

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

            $task = $tm->retrieveTask($taskId);

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

         * @param VTTask        $task

    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 deletes workflow task.

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

        public function isActive()

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

        {

    Line exceeds 120 characters; contains 153 characters
    Open

            return $workflowModeIterationOff && (VTTask::RECORD_EVENT_DOUBLE_MODE === $recordEventMode || VTTask::RECORD_EVENT_INACTIVE === $recordEventMode)

    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

         * Return task manager object.

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

            return $this->task_manager;

    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 edit view url.

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

        public function getChangeStatusUrl()

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

        public function getWorkflow()

    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 all tasks for workflow.

    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 int      $taskId

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

         * @return VTTask

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

         * @return VTTask

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

        public static function getInstanceFromTaskObject($task, $workflowModel, $tm)

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

                $taskId = $task->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

        {

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

            $taskObject = $this->getTaskObject();

    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

         * Return task object.

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

            $url = 'index.php?module=Workflows&parent=Settings&view=EditTask&type=' . $this->task_type->getName() . '&for_workflow=' . $this->getWorkflow()->getId();

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

            return 'index.php?module=Workflows&parent=Settings&action=TaskAjax&mode=delete&task_id=' . $this->getId();

    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

        public function getTaskType()

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

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

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

         * @param Settings_Workflows_TaskType_Model $taskType

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

    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 int $workflowId

    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 $this->get('task_id');

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

            return $workflowModeIterationOff && (VTTask::RECORD_EVENT_DOUBLE_MODE === $recordEventMode || VTTask::RECORD_EVENT_INACTIVE === $recordEventMode)

    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 VTTaskManager $tm

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

        }

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

         * Return task record id.

    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

         *

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

        public function isEditable(): bool

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

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

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

            $this->workflow = $workflowModel;

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

         * @return Settings_Workflows_TaskType_Model

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

        public function setTaskType(Settings_Workflows_TaskType_Model $taskType): self

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

        {

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

            $tasks = $tm->getTasksForWorkflow($workflowModel->getId(), $active);

    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

        public function save()

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

            $this->task_manager->saveTask($taskObject);

    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::TASK_STATUS_ACTIVE == $this->get('status');

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

         * Check if record is editable.

    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 setTaskObject($task)

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

        public function getTaskManager()

    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 ($this->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

         * Set workflow from instance.

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

                if (!empty($taskObject)) {

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

                    $taskClass = \get_class($taskObject);

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

                        $taskModels[$task->id] = $taskRecord;

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

            return $taskModels;

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

                $workflowModel = Settings_Workflows_Record_Model::getInstance($task->workflowId);

    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

        {

    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

         * Set task type model.

    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 instance.

    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

                ->max('sequence') + 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

        }

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

         * @param VTTask $task

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

        public function setTaskManager($tm)

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

            $this->task_manager = $tm;

    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 getAllForWorkflow(Settings_Workflows_Record_Model $workflowModel, $active = false)

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

         * @param Workflow $workflowModel

    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 object $workflowModel

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

        }

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

            $this->task_manager->deleteTask($this->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

            $task = $tm->createTask($taskName, $workflowModel->getId());

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

         * @return int

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

         * Check if task is active.

    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

        {

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

    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 workflow object.

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

         * Return task type.

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

        {

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

                }

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

         *

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

        /**

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

            $this->set('summary', $taskObject->summary)->set('status', $taskObject->active);

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

         * @return VTTask[]

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

                if (!$active || self::TASK_STATUS_ACTIVE == $task->active) {

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

                    $taskRecord = self::getInstanceFromTaskObject($task, $workflowModel, $tm);

    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

                $taskId = false;

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

            $taskModel = new self();

    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 function getCleanInstance($workflowModel, $taskName)

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

         * @param VTTaskManager $tm

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

         *

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

                ->setTaskObject($task)->setWorkflowFromInstance($workflowModel);

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

                ->where(['workflow_id' => $workflowId])

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

    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 Workflow      $workflowModel

    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 (isset($task->id)) {

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

        public function getNextSequenceNumber(int $workflowId): int

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

         * @param bool                            $active

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

            foreach ($tasks as $task) {

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

        public static function getInstance($taskId, $workflowModel = null)

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

            $tm = new VTTaskManager();

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

         * @return VTTask

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

            return self::getInstanceFromTaskObject($task, $workflowModel, $tm);

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

            $summary = $task->summary;

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

            return $taskModel->set('task_id', $taskId)->set('summary', $summary)->set('status', $status)

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

    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 Settings_Workflows_Record_Model $workflowModel

    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

            $tm = new VTTaskManager();

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

        {

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

                ->from('com_vtiger_workflowtasks')

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

    class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model

    There are no issues that match your filters.

    Category
    Status