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.
*
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 = [];
- Read upRead up
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
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '311', column '15'). Open
return (new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '253', column '13'). Open
$tm = new VTTaskManager();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
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)
- Read upRead up
- Exclude checks
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();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
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;
}
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Workflows_Record_Model' in method 'getInstance'. Open
$workflowModel = Settings_Workflows_Record_Model::getInstance($task->workflowId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Define a constant instead of duplicating this literal "status" 3 times. Open
return self::TASK_STATUS_ACTIVE == $this->get('status');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "summary" 3 times. Open
return $this->get('summary');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Reference to undeclared property \VTTask->id
Open
$taskId = $task->id;
- Exclude checks
Reference to undeclared property \VTTask->active
Open
$status = $task->active;
- Exclude checks
Call to undeclared method \Workflow::getParams
Open
$workflowModeIterationOff = $this->getWorkflow()->getParams('iterationOff');
- Exclude checks
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);
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
(Did you mean $taskType) Open
$this->task_type = $taskType;
- Exclude checks
Reference to undeclared property \VTTask->summary
Open
$summary = $task->summary;
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
Open
$this->task_type = Settings_Workflows_TaskType_Model::getInstanceFromClassName($taskClass);
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
Open
return $this->task_type;
- Exclude checks
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)
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_object
Open
$this->task_object = $task;
- Exclude checks
Reference to undeclared property \VTTask->id
Open
if (isset($task->id)) {
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->workflow
Open
return $this->workflow;
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->workflow
Open
$this->workflow = $workflowModel;
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
Open
$this->task_manager->saveTask($taskObject);
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_type
Open
if (empty($this->task_type)) {
- Exclude checks
Call to undeclared method \VTTask::isEditable
Open
if (!$active || $taskRecord->isEditable()) {
- Exclude checks
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);
- Exclude checks
Reference to undeclared property \VTTask->summary
Open
$this->set('summary', $taskObject->summary)->set('status', $taskObject->active);
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
Open
return $this->task_manager;
- Exclude checks
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();
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_object
Open
return $this->task_object;
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
Open
$this->task_manager->deleteTask($this->getId());
- Exclude checks
Reference to undeclared property \VTTask->active
Open
$this->set('summary', $taskObject->summary)->set('status', $taskObject->active);
- Exclude checks
Reference to undeclared property \VTTask->workflowId
Open
$workflowModel = Settings_Workflows_Record_Model::getInstance($task->workflowId);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
return (new \App\Db\Query())
- Exclude checks
Reference to undeclared property \Settings_Workflows_TaskRecord_Model->task_manager
Open
$this->task_manager = $tm;
- Exclude checks
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();
- Exclude checks
Avoid excessively long variable names like $workflowModeIterationOff. Keep variable name length under 20. Open
$workflowModeIterationOff = $this->getWorkflow()->getParams('iterationOff');
- Read upRead up
- Exclude checks
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
- Exclude checks
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
- Exclude checks
Avoid variables with short names like $tm. Configured minimum length is 3. Open
$tm = new VTTaskManager();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $tm. Configured minimum length is 3. Open
$tm = new VTTaskManager();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $tm. Configured minimum length is 3. Open
public static function getInstanceFromTaskObject($task, $workflowModel, $tm)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $tm. Configured minimum length is 3. Open
$tm = new VTTaskManager();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class Settings_Workflows_TaskRecord_Model is not named in CamelCase. Open
class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model
{
/**
* Task status active.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $tm. Configured minimum length is 3. Open
public function setTaskManager($tm)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Task status active.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return task record name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflowModeIterationOff = $this->getWorkflow()->getParams('iterationOff');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return VTTask
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->task_object;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set task object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->task_object = $task;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDeleteActionUrl()
- Exclude checks
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();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param object $workflowModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setWorkflowFromInstance($workflowModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordEventMode = $this->getTaskObject()->recordEventState ?? VTTask::RECORD_EVENT_ACTIVE;
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
|| (!$workflowModeIterationOff && (VTTask::RECORD_EVENT_DOUBLE_MODE === $recordEventMode || VTTask::RECORD_EVENT_ACTIVE === $recordEventMode));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return VTTaskManager
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* return change status url.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Workflow
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set task manager object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->task_type;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->task_type = $taskType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| (!$workflowModeIterationOff && (VTTask::RECORD_EVENT_DOUBLE_MODE === $recordEventMode || VTTask::RECORD_EVENT_ACTIVE === $recordEventMode));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskObject = $this->getTaskObject();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return clean instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskModel->setTaskManager($tm);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function saves workflow task.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getName()
- Exclude checks
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();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$url .= '&task_id=' . $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->workflow;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tm = new VTTaskManager();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null === $workflowModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::getInstanceFromTaskObject($task, $workflowModel, $tm);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = $task->active;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get next task action sequence number.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const TASK_STATUS_ACTIVE = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('summary');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return delete action url.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->task_type = Settings_Workflows_TaskType_Model::getInstanceFromClassName($taskClass);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskModels = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$active || $taskRecord->isEditable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task = $tm->retrieveTask($taskId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param VTTask $task
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function deletes workflow task.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isActive()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
return $workflowModeIterationOff && (VTTask::RECORD_EVENT_DOUBLE_MODE === $recordEventMode || VTTask::RECORD_EVENT_INACTIVE === $recordEventMode)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return task manager object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->task_manager;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return edit view url.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getChangeStatusUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWorkflow()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return all tasks for workflow.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $taskId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return VTTask
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return VTTask
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceFromTaskObject($task, $workflowModel, $tm)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskId = $task->id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskObject = $this->getTaskObject();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return task object.
- Exclude checks
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();
- Exclude checks
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();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTaskType()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->task_type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Settings_Workflows_TaskType_Model $taskType
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function delete()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $workflowId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('task_id');
- Exclude checks
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)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param VTTaskManager $tm
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return task record id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isEditable(): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTaskObject()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $url;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->workflow = $workflowModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Workflows_TaskType_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setTaskType(Settings_Workflows_TaskType_Model $taskType): self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tasks = $tm->getTasksForWorkflow($workflowModel->getId(), $active);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function save()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->task_manager->saveTask($taskObject);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::TASK_STATUS_ACTIVE == $this->get('status');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if record is editable.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setTaskObject($task)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTaskManager()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set workflow from instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($taskObject)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskClass = \get_class($taskObject);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskModels[$task->id] = $taskRecord;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $taskModels;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$workflowModel = Settings_Workflows_Record_Model::getInstance($task->workflowId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set task type model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->max('sequence') + 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param VTTask $task
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setTaskManager($tm)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->task_manager = $tm;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAllForWorkflow(Settings_Workflows_Record_Model $workflowModel, $active = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Workflow $workflowModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param object $workflowModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->task_manager->deleteTask($this->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task = $tm->createTask($taskName, $workflowModel->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if task is active.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getEditViewUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return workflow object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return task type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('summary', $taskObject->summary)->set('status', $taskObject->active);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return VTTask[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$active || self::TASK_STATUS_ACTIVE == $task->active) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskRecord = self::getInstanceFromTaskObject($task, $workflowModel, $tm);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskId = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskModel = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getCleanInstance($workflowModel, $taskName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param VTTaskManager $tm
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setTaskObject($task)->setWorkflowFromInstance($workflowModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['workflow_id' => $workflowId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $taskName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Workflow $workflowModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($task->id)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getNextSequenceNumber(int $workflowId): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $active
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tasks as $task) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance($taskId, $workflowModel = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tm = new VTTaskManager();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return VTTask
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::getInstanceFromTaskObject($task, $workflowModel, $tm);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$summary = $task->summary;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $taskModel->set('task_id', $taskId)->set('summary', $summary)->set('status', $status)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Settings_Workflows_Record_Model $workflowModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tm = new VTTaskManager();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('com_vtiger_workflowtasks')
- Exclude checks
Class name "Settings_Workflows_TaskRecord_Model" is not in camel caps format Open
class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model
- Exclude checks