File Gantt.php
has 564 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Gantt Model class.
*
Method getProject
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getProject($id, $viewName = null)
{
if (!\is_array($id) && isset($this->tasksById[$id])) {
return [$this->tasksById[$id]];
}
The class Project_Gantt_Model has an overall complexity of 124 which is very high. The configured complexity threshold is 50. Open
class Project_Gantt_Model
{
/**
* @var array project tasks,milesones and projects
*/
- Exclude checks
Method getGanttTasks
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGanttTasks($projectIds)
{
$taskTime = 0;
$queryGenerator = new App\QueryGenerator('ProjectTask');
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
Method getGanttMilestones
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGanttMilestones($projectIds)
{
$queryGenerator = new App\QueryGenerator('ProjectMilestone');
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
$queryGenerator->addNativeCondition(['vtiger_projectmilestone.projectid' => $projectIds]);
Function cleanup
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function cleanup($tasks)
{
$clean = [];
foreach ($tasks as $task) {
if (0 !== $task['id']) {
- 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
Function normalizeParents
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function normalizeParents()
{
// not set parents are children of root node
foreach ($this->tasks as &$task) {
if (!isset($task['parent']) && 0 !== $task['id']) {
- 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
Function getProject
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function getProject($id, $viewName = null)
{
if (!\is_array($id) && isset($this->tasksById[$id])) {
return [$this->tasksById[$id]];
}
- 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
Project_Gantt_Model
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Project_Gantt_Model
{
/**
* @var array project tasks,milesones and projects
*/
Function getStatuses
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getStatuses()
{
$closingStatuses = Settings_RealizationProcesses_Module_Model::getStatusNotModify();
if (empty($closingStatuses['Project'])) {
$closingStatuses['Project'] = ['status' => []];
- 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
Method getStatuses
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStatuses()
{
$closingStatuses = Settings_RealizationProcesses_Module_Model::getStatusNotModify();
if (empty($closingStatuses['Project'])) {
$closingStatuses['Project'] = ['status' => []];
Function calculateLevels
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function calculateLevels()
{
$parents = $this->getAllParentRecordsIds();
foreach ($this->tasks as &$task) {
$task['level'] = \count($parents[$task['id']]);
- 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
Method getById
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getById($id)
{
$this->getStatuses();
$projects = $this->getProject($id);
$title = '';
Method findOutStartDates
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function findOutStartDates(&$node)
{
$maxTimeStampValue = 2147483647;
$firstDate = $this->iterateNodes($node, $maxTimeStampValue, function (&$child, $firstDate) {
if (!empty($child['start_date']) && '1970-01-01' !== $child['start_date']) {
Function getParentRecordsIdsRecursive
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getParentRecordsIdsRecursive($parentId, $parents = [])
{
if (empty($parentId)) {
return $parents;
}
- 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
Function getById
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getById($id)
{
$this->getStatuses();
$projects = $this->getProject($id);
$title = '';
- 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
Function getGanttTasks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getGanttTasks($projectIds)
{
$taskTime = 0;
$queryGenerator = new App\QueryGenerator('ProjectTask');
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
- 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
Function getGanttMilestones
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getGanttMilestones($projectIds)
{
$queryGenerator = new App\QueryGenerator('ProjectMilestone');
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
$queryGenerator->addNativeCondition(['vtiger_projectmilestone.projectid' => $projectIds]);
- 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
Function getRecordWithChildren
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function &getRecordWithChildren(&$task)
{
foreach ($this->tasks as &$child) {
if (isset($child['parent']) && $child['parent'] === $task['id']) {
if (empty($task['children'])) {
- 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
The method getProject() has an NPath complexity of 82992. The configured NPath complexity threshold is 200. Open
private function getProject($id, $viewName = null)
{
if (!\is_array($id) && isset($this->tasksById[$id])) {
return [$this->tasksById[$id]];
}
- Read upRead up
- Exclude checks
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 getStatuses() has an NPath complexity of 432. The configured NPath complexity threshold is 200. Open
public function getStatuses()
{
$closingStatuses = Settings_RealizationProcesses_Module_Model::getStatusNotModify();
if (empty($closingStatuses['Project'])) {
$closingStatuses['Project'] = ['status' => []];
- Read upRead up
- Exclude checks
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 getStatuses() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function getStatuses()
{
$closingStatuses = Settings_RealizationProcesses_Module_Model::getStatusNotModify();
if (empty($closingStatuses['Project'])) {
$closingStatuses['Project'] = ['status' => []];
- Read upRead up
- Exclude checks
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
The method getProject() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10. Open
private function getProject($id, $viewName = null)
{
if (!\is_array($id) && isset($this->tasksById[$id])) {
return [$this->tasksById[$id]];
}
- Read upRead up
- Exclude checks
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
The method findOutStartDates() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
private function findOutStartDates(&$node)
{
$maxTimeStampValue = 2147483647;
$firstDate = $this->iterateNodes($node, $maxTimeStampValue, function (&$child, $firstDate) {
if (!empty($child['start_date']) && '1970-01-01' !== $child['start_date']) {
- Read upRead up
- Exclude checks
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 18 to the 15 allowed. Open
private function cleanup($tasks)
- Read upRead up
- Exclude checks
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
Class "Project_Gantt_Model" has 21 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Project_Gantt_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.
Refactor this function to reduce its Cognitive Complexity from 31 to the 15 allowed. Open
private function getProject($id, $viewName = null)
- Read upRead up
- Exclude checks
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
Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed. Open
private function normalizeParents()
- Read upRead up
- Exclude checks
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
Avoid using undefined variables such as '$childrenIds' which will lead to PHP notices. Open
$childrenIds[] = $row['id'];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$childrenIds' which will lead to PHP notices. Open
$projects = array_merge($projects, $this->getProject($childrenIds, $viewName));
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$queryGenerator' which will lead to PHP notices. Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$projectIdsRows' which will lead to PHP notices. Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$rootProjectIds' which will lead to PHP notices. Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$childrenIds' which will lead to PHP notices. Open
if (!empty($childrenIds)) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '686', column '25'). Open
$queryGenerator = new App\QueryGenerator('ProjectTask');
- 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 '134', column '22'). Open
return ((int) (new DateTime($startDateStr))->diff(new DateTime($endDateStr), true)->format('%a')) * 24 * 60 * 60 * 1000;
- 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 '443', column '25'). Open
$queryGenerator = new App\QueryGenerator('Project');
- 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 '610', column '25'). Open
$queryGenerator = new App\QueryGenerator('ProjectMilestone');
- 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 '134', column '57'). Open
return ((int) (new DateTime($startDateStr))->diff(new DateTime($endDateStr), true)->format('%a')) * 24 * 60 * 60 * 1000;
- 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
Avoid assigning values to variables in if clauses and the like (line '652', column '8'). Open
public function getGanttMilestones($projectIds)
{
$queryGenerator = new App\QueryGenerator('ProjectMilestone');
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
$queryGenerator->addNativeCondition(['vtiger_projectmilestone.projectid' => $projectIds]);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Colors' in method 'getStatuses'. Open
$colors['Project']['projectstatus'][$value['projectstatus']] = \App\Colors::get($value['color'] ?? '', $value['projectstatus']);
- 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 '\App\Colors' in method 'getStatuses'. Open
$colors['ProjectMilestone']['projectmilestone_status'][$value['projectmilestone_status']] = \App\Colors::get($value['color'] ?? '', $value['projectmilestone_status']);
- 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 '\App\Language' in method 'getProject'. Open
'priority_label' => \App\Language::translate($row['projectpriority'] ?? '', 'Project'),
- 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
The method getProject uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$project['dependentOn'] = [$project['parentId']];
}
- 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 '\App\Language' in method 'getGanttTasks'. Open
'priority_label' => \App\Language::translate($row['projecttaskpriority'] ?? '', 'ProjectTask'),
- 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 'App\Language' in method 'getStatuses'. Open
$this->statuses['Project'][] = $status = ['value' => $value['projectstatus'], 'label' => App\Language::translate($value['projectstatus'], 'Project'), 'closing' => \in_array($value['projectstatus'], $closingStatuses['Project']['status'])];
- 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 '\App\Fields\Owner' in method 'getGanttTasks'. Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- 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_RealizationProcesses_Module_Model' in method 'getStatuses'. Open
$closingStatuses = Settings_RealizationProcesses_Module_Model::getStatusNotModify();
- 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 'App\Language' in method 'getStatuses'. Open
$this->statuses['ProjectMilestone'][] = $status = ['value' => $value['projectmilestone_status'], 'label' => App\Language::translate($value['projectmilestone_status'], 'ProjectMilestone'), 'closing' => \in_array($value['projectmilestone_status'], $closingStatuses['ProjectMilestone']['status'])];
- 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
The method getGanttMilestones uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$milestone['dependentOn'] = [$milestone['parentId']];
}
- 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 '\App\Fields\Owner' in method 'getProject'. Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- 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 'App\Fields\Picklist' in method 'getStatuses'. Open
$projectMilestone = array_values(App\Fields\Picklist::getValues('projectmilestone_status'));
- 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 'App\Fields\Picklist' in method 'getStatuses'. Open
$project = array_values(App\Fields\Picklist::getValues('projectstatus'));
- 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 'App\Fields\Picklist' in method 'getStatuses'. Open
$projectTask = array_values(App\Fields\Picklist::getValues('projecttaskstatus'));
- 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 '\App\Config' in method 'getStatuses'. Open
$configColors = \App\Config::module('Project', 'defaultGanttColors');
- 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
The method getProject uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$query = $queryGenerator->createQuery();
}
- 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 'App\Language' in method 'getProject'. Open
'status_label' => App\Language::translate($row['projectstatus'], 'Project'),
- 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
The method calculateLevels uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$task['hasChild'] = 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 '\App\Colors' in method 'getProject'. Open
'color' => ($row['projectstatus'] && isset($this->statusColors['Project']['projectstatus'][$row['projectstatus']])) ? $this->statusColors['Project']['projectstatus'][$row['projectstatus']] : \App\Colors::getRandomColor('projectstatus_' . $row['id']),
- 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
The method getStatuses uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->statusColors = $colors;
}
- 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 'App\Language' in method 'getGanttTasks'. Open
'status_label' => App\Language::translate($row['projecttaskstatus'], 'ProjectTask'),
- 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 'App\Colors' in method 'getGanttTasks'. Open
'color' => ($row['projecttaskstatus'] && isset($this->statusColors['ProjectTask']['projecttaskstatus'][$row['projecttaskstatus']])) ? $this->statusColors['ProjectTask']['projecttaskstatus'][$row['projecttaskstatus']] : App\Colors::getRandomColor('projecttaskstatus_' . $row['id']),
- 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
The method getAllParentRecordsIds uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$parents[$task['id']] = [];
}
- 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 'App\Colors' in method 'getGanttMilestones'. Open
'color' => ($row['projectmilestone_status'] && isset($this->statusColors['ProjectMilestone']['projectmilestone_status'][$row['projectmilestone_status']])) ? $this->statusColors['ProjectMilestone']['projectmilestone_status'][$row['projectmilestone_status']] : App\Colors::getRandomColor('projectmilestone_status_' . $row['id']),
- 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 'App\Language' in method 'getStatuses'. Open
$this->statuses['ProjectTask'][] = $status = ['value' => $value['projecttaskstatus'], 'label' => App\Language::translate($value['projecttaskstatus'], 'ProjectTask'), 'closing' => \in_array($value['projecttaskstatus'], $closingStatuses['ProjectTask']['status'])];
- 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 '\App\Colors' in method 'getStatuses'. Open
$colors['ProjectTask']['projecttaskstatus'][$value['projecttaskstatus']] = \App\Colors::get($value['color'] ?? '', $value['projecttaskstatus']);
- 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 '\App\Fields\Owner' in method 'getGanttMilestones'. Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- 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 "priority" 3 times. Open
'priority' => $queryGenerator->getModuleField('projectpriority')->getDisplayValue($row['projectpriority'], $row['id'], false, true),
- 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 "Y-m-d H:i:s" 5 times. Open
$node['start'] = date('Y-m-d H:i:s', $firstDate);
- 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 "canDelete" 5 times. Open
'canDelete' => false,
- 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 "sum_time" 12 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "1970-01-01" 3 times. Open
if (!empty($child['start_date']) && '1970-01-01' !== $child['start_date']) {
- 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 "cantWriteOnParent" 5 times. Open
'cantWriteOnParent' => false,
- 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 "projecttaskname" 3 times. Open
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
- 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 "projectmilestone_priority" 5 times. Open
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
- 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 "targetenddate" 9 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "projectstatus" 16 times. Open
$project = array_values(App\Fields\Picklist::getValues('projectstatus'));
- 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 "projecttask_no" 3 times. Open
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
- 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 "Y-m-d" 16 times. Open
if ($firstDate < 0 || '2038-01-19' === date('Y-m-d', $firstDate)) {
- 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 "children" 14 times. Open
if (empty($task['children'])) {
- 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 "progress" 7 times. Open
if (!isset($task['progress'])) {
- 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 "value" 3 times. Open
$this->statuses['Project'][] = $status = ['value' => $value['projectstatus'], 'label' => App\Language::translate($value['projectstatus'], 'Project'), 'closing' => \in_array($value['projectstatus'], $closingStatuses['Project']['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 "projectname" 3 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "ProjectMilestone" 12 times. Open
if (empty($closingStatuses['ProjectMilestone'])) {
- 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 "end_date" 14 times. Open
$taskDate = strtotime($child['end_date']);
- 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 "color" 15 times. Open
$colors['Project']['projectstatus'][$value['projectstatus']] = \App\Colors::get($value['color'] ?? '', $value['projectstatus']);
- 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 "projecttaskstatus" 16 times. Open
$projectTask = array_values(App\Fields\Picklist::getValues('projecttaskstatus'));
- 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 "border" 3 times. Open
'border' => $project['color']
- 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 "planned_duration" 3 times. Open
$project['planned_duration'] = $project['estimated_work_time'];
- 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 "project_no" 3 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "label" 7 times. Open
$this->statuses['Project'][] = $status = ['value' => $value['projectstatus'], 'label' => App\Language::translate($value['projectstatus'], 'Project'), 'closing' => \in_array($value['projectstatus'], $closingStatuses['Project']['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 "projectmilestone_no" 3 times. Open
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
- 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 "canWrite" 5 times. Open
'canWrite' => false,
- 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 "dependentOn" 3 times. Open
$project['dependentOn'] = [$project['parentId']];
- 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 "start_date" 16 times. Open
if (!empty($child['start_date']) && '1970-01-01' !== $child['start_date']) {
- 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 "parent" 13 times. Open
if (!empty($task['parent'])) {
- 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 "parents" 3 times. Open
$task['parents'] = $parents[$task['id']];
- 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 "" href="" 3 times. Open
$project['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $project['no'] . '" href="' . $project['url'] . '" target="_blank" rel="noreferrer noopener">' . $project['no'] . '</a>';
- 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 "module" 3 times. Open
'module' => 'Project',
- 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 "closing" 6 times. Open
$this->statuses['Project'][] = $status = ['value' => $value['projectstatus'], 'label' => App\Language::translate($value['projectstatus'], 'Project'), 'closing' => \in_array($value['projectstatus'], $closingStatuses['Project']['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 "assigned_user_id" 12 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "assigned_user_name" 3 times. Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- 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 "ProjectTask" 14 times. Open
if (empty($closingStatuses['ProjectTask'])) {
- 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 "projectpriority" 4 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "<a class="showReferenceTooltip js-popover-tooltip--record" title="" times.></a> Open
$project['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $project['no'] . '" href="' . $project['url'] . '" target="_blank" rel="noreferrer noopener">' . $project['no'] . '</a>';
- 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 "number" 3 times. Open
$project['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $project['no'] . '" href="' . $project['url'] . '" target="_blank" rel="noreferrer noopener">' . $project['no'] . '</a>';
- 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 "estimated_work_time" 16 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "parentId" 11 times. Open
'parentId' => !empty($row['parentid']) ? $row['parentid'] : null,
- 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 "projectmilestone_status" 17 times. Open
$projectMilestone = array_values(App\Fields\Picklist::getValues('projectmilestone_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 "priority_label" 3 times. Open
'priority_label' => \App\Language::translate($row['projectpriority'] ?? '', 'Project'),
- 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 "depends" 3 times. Open
$task['depends'] = '';
- 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 "projecttaskpriority" 4 times. Open
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
- 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 "status_label" 3 times. Open
'status_label' => App\Language::translate($row['projectstatus'], 'Project'),
- 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 "startdate" 7 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "parentid" 11 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "style" 3 times. Open
$project['style'] = [
- 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 "projectid" 8 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "canAdd" 5 times. Open
'canAdd' => false,
- 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 "start" 5 times. Open
$node['start'] = date('Y-m-d H:i:s', $firstDate);
- 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 "duration" 5 times. Open
$node['duration'] = 24 * 60 * 60 * 1000;
- 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 "normalized_status" 3 times. Open
'normalized_status' => $queryGenerator->getModuleField('projectstatus')->getDisplayValue($row['projectstatus'], $row['id'], false, true),
- 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 "Project" 15 times. Open
if (empty($closingStatuses['Project'])) {
- 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 "status" 9 times. Open
$closingStatuses['Project'] = ['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 "projectmilestonename" 3 times. Open
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
- 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 "description" 4 times. Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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 "STATUS_ACTIVE" 3 times. Open
'status' => 'STATUS_ACTIVE',
- 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.
Avoid unused local variables such as '$projectIdsRows'. Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$queryGenerator'. Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$rootProjectIds'. Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$milestoneName = $queryGenerator->getModuleField('projectmilestonename')->getDisplayValue($row['projectmilestonename'], $row['id'], false, true);
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addNativeCondition([
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'no' => $queryGenerator->getModuleField('projecttask_no')->getDisplayValue($row['projecttask_no'], $row['id'], false, true),
- Exclude checks
Call to method getUserLabel
from undeclared class \App\Fields\Owner
Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- Exclude checks
Parameter $tasks
has undeclared type \task[]
Open
private function cleanup($tasks)
- Exclude checks
Suspicious array access to \task
Open
$task['depends'] = '';
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'normalized_status' => $queryGenerator->getModuleField('projectstatus')->getDisplayValue($row['projectstatus'], $row['id'], false, true),
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new App\QueryGenerator('ProjectMilestone');
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'estimated_work_time' => $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'priority' => $queryGenerator->getModuleField('projecttaskpriority')->getDisplayValue($row['projecttaskpriority'], $row['id'], false, true),
- Exclude checks
Return type of flattenRecordTasks()
is undeclared type \task[]
Open
private function flattenRecordTasks($nodes, $flat = [])
- Exclude checks
Suspicious attempt to unset an offset of a value of type \task
Open
unset($task['parent']);
- Exclude checks
Variable $rootProjectIds
is undeclared Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Exclude checks
Return type of getGanttMilestones()
is undeclared type \milestone[]
Open
public function getGanttMilestones($projectIds)
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addNativeCondition([
- Exclude checks
Variable $queryGenerator
is undeclared Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'status_label' => $queryGenerator->getModuleField('projectmilestone_status')->getDisplayValue($row['projectmilestone_status'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'normalized_status' => $queryGenerator->getModuleField('projecttaskstatus')->getDisplayValue($row['projecttaskstatus'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'estimated_work_time' => $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true),
- Exclude checks
Variable $childrenIds
was undeclared, but array fields are being added to it. Open
$childrenIds[] = $row['id'];
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$projectName = $queryGenerator->getModuleField('projectname')->getDisplayValue($row['projectname'], $row['id'], false, true);
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->addNativeCondition(['vtiger_projectmilestone.projectid' => $projectIds]);
- Exclude checks
Variable $projectIdsRows
is undeclared Open
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- Exclude checks
Return type of cleanup()
is undeclared type \task[]
Open
private function cleanup($tasks)
- Exclude checks
Return type of getGanttTasks()
is undeclared type \task[]
Open
public function getGanttTasks($projectIds)
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'no' => $queryGenerator->getModuleField('project_no')->getDisplayValue($row['project_no'], $row['id'], false, true),
- Exclude checks
Call to method getUserLabel
from undeclared class \App\Fields\Owner
Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$task['planned_duration'] = $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true);
- Exclude checks
Suspicious array access to \task
Open
if (0 !== $task['id']) {
- Exclude checks
Suspicious array access to \task
Open
if (0 === $task['parent']) {
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'priority_label' => $queryGenerator->getModuleField('projectmilestone_priority')->getDisplayValue($row['projectmilestone_priority'], $row['id'], false, true),
- Exclude checks
Call to method getUserLabel
from undeclared class \App\Fields\Owner
Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$milestone['v'] = $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true);
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$taskName = $queryGenerator->getModuleField('projecttaskname')->getDisplayValue($row['projecttaskname'], $row['id'], false, true);
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new App\QueryGenerator('ProjectTask');
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query = $queryGenerator->createQuery();
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'priority' => $queryGenerator->getModuleField('projectpriority')->getDisplayValue($row['projectpriority'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'no' => $queryGenerator->getModuleField('projectmilestone_no')->getDisplayValue($row['projectmilestone_no'], $row['id'], false, true),
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new App\QueryGenerator('Project');
- Exclude checks
Call to method getCustomViewQueryById
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query = $queryGenerator->getCustomViewQueryById($viewName);
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'description' => $queryGenerator->getModuleField('description')->getDisplayValue($row['description'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'normalized_status' => $queryGenerator->getModuleField('projectmilestone_status')->getDisplayValue($row['projectmilestone_status'], $row['id'], false, true),
- Exclude checks
Call to method getModuleField
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
'priority' => $queryGenerator->getModuleField('projectmilestone_priority')->getDisplayValue($row['projectmilestone_priority'], $row['id'], false, true),
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach ($project as $value) {
$this->statuses['Project'][] = $status = ['value' => $value['projectstatus'], 'label' => App\Language::translate($value['projectstatus'], 'Project'), 'closing' => \in_array($value['projectstatus'], $closingStatuses['Project']['status'])];
if (!$status['closing']) {
$this->activeStatuses['Project'][] = $status;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 152.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach ($projectMilestone as $value) {
$this->statuses['ProjectMilestone'][] = $status = ['value' => $value['projectmilestone_status'], 'label' => App\Language::translate($value['projectmilestone_status'], 'ProjectMilestone'), 'closing' => \in_array($value['projectmilestone_status'], $closingStatuses['ProjectMilestone']['status'])];
if (!$status['closing']) {
$this->activeStatuses['ProjectMilestone'][] = $status;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 152.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
foreach ($projectTask as $value) {
$this->statuses['ProjectTask'][] = $status = ['value' => $value['projecttaskstatus'], 'label' => App\Language::translate($value['projecttaskstatus'], 'ProjectTask'), 'closing' => \in_array($value['projecttaskstatus'], $closingStatuses['ProjectTask']['status'])];
if (!$status['closing']) {
$this->activeStatuses['ProjectTask'][] = $status;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 152.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Project_Gantt_Model
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
private function getProject($id, $viewName = null)
- 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 Project_Gantt_Model is not named in CamelCase. Open
class Project_Gantt_Model
{
/**
* @var array project tasks,milesones and projects
*/
- 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 $id. Configured minimum length is 3. Open
public function getById($id)
- 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
$parents = $this->getParentRecordsIdsRecursive($task['parent'], $parents);
- 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
private function getAllParentRecordsIds()
- 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
* Calculate task levels and dependencies.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Calculate duration in seconds.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array if some task is already loaded get it from here
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get parent nodes id as associative array [taskId]=>[parentId1,parentId2,...].
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($parentId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($parents as $parentsId) {
- 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
foreach ($this->tasks as &$task) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array rootNode needed for tree generation process
- 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 array $parents initial value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($task['parent'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parents[$task['id']] = $this->getParentRecordsIdsRecursive($task['parent']);
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($task['id'], $hasChild)) {
- 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 $statusColors = [];
- 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 $parents;
- 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
* Normalize task parent property set as 0 if not exists (root node).
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array project tasks,milesones and projects
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $tree = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $tasksById = [];
- 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
$parents[$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
// not set parents are children of root node
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$idExists = false;
- 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 $parents;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['hasChild'] = true;
- 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
private $statuses;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($task['id'] === $parentId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// if parent id is set but we don't have it - it means that project is subproject so connect it to root node
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($task['parent'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array colors for statuses
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array statuses - with closing value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($parentId, $parents)) {
- 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
* Collect all parents of all tasks.
- 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
foreach ($this->tasks as $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
* @param string $startDateStr
- 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 array task nodes as tree with children
- 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 $parents;
- 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 int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function normalizeParents()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['parent'] = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $activeStatuses;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- 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
foreach ($this->tasks as &$task) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($parentsId as $parentId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $endDateStr
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $tasks = [];
- 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
unset($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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['hasChild'] = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($parents);
- 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
private $rootNode;
- 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
foreach ($this->tasks as $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
$parents = $this->getAllParentRecordsIds();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['level'] = \count($parents[$task['id']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($parentId, $hasChild)) {
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
return ((int) (new DateTime($startDateStr))->diff(new DateTime($endDateStr), true)->format('%a')) * 24 * 60 * 60 * 1000;
- 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function calculateLevels()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hasChild = [];
- 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 array - without closing value - for JS filter
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parents[] = $parentId;
- 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
private function calculateDuration($startDateStr, $endDateStr): 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
if (!isset($task['parent']) && 0 !== $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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|string $parentId
- 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
private function getParentRecordsIdsRecursive($parentId, $parents = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parents = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($task['parent'])) {
- 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['parents'] = $parents[$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
$hasChild[] = $parentId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ((int) (new DateTime($startDateStr))->diff(new DateTime($endDateStr), true)->format('%a')) * 24 * 60 * 60 * 1000;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->tasks as &$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
foreach ($this->tasks as &$task) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param $nodes tasks tree
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($node['children'])) {
- 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 (0 === $task['parent']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($task['children']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param callable $callback what to do with task
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($child['start_date']) && '1970-01-01' !== $child['start_date']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['children'][] = &$this->getRecordWithChildren($child);
- 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
private function cleanup($tasks)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($task['parent']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$clean[] = $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
if (empty($node['children'])) {
- 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 (empty($node['start_date'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array task with parents property 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
$this->tree = &$this->getRecordWithChildren($this->rootNode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentValue = $callback($child, $currentValue);
- 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
$node['start'] = date('Y-m-d H:i:s', $firstDate);
- 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
if (isset($task['parents'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $clean;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$idExists) {
- 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
* Collect task all parent nodes.
- 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
* Remove root node and children because they are not needed anymore.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param task[] $tasks
- 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
$idExists = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- 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
private function collectChildrens()
- 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
unset($task['depends']);
- 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 $currentValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $currentValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $firstDate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstDate = strtotime(date('Y-m-d'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->tasks as $parent) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($task['parent'] === $parent['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
private function &getRecordWithChildren(&$task)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($task['children'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Flatten task tree with proper order to use it in frontend gantt lib.
- 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
Line exceeds 120 characters; contains 123 characters Open
* @param mixed $currentValue initial result which will be evaluated if there are some child nodes like array reduce
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentValue = $this->iterateNodes($child, $currentValue, $callback);
- 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['parent'] = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['children'] = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add root node to generate tree structure.
- 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 mixed
- 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->iterateNodes($node, $firstDate, function (&$child, $firstDate) {
- 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
array_unshift($this->tasks, $this->rootNode);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($task['parents']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($task['depends'])) {
- 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 ($firstDate < 0 || '2038-01-19' === date('Y-m-d', $firstDate)) {
- 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
* @param array $flat initial array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($task['children'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['progress'] = 100;
- 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 (isset($child['parent']) && $child['parent'] === $task['id']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($nodes as $node) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sort all node types (task,milestones,projects) so each parent task is before its child (frontend lib needs 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
private function addRootNode()
- 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
}
- 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
* Iterate through children and search for start date.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($taskStartDate < $firstDate && $taskStartDate > 0) {
- 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
$flat[] = $node;
- 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[] new array (not mutated)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$clean = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== $task['id']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['depends'] = '';
- 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
* Iterate through all tasks in tree.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $node starting point - might by rootNode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($node['children'] as &$child) {
- 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
$node['duration'] = 24 * 60 * 60 * 1000;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$node['start_date'] = date('Y-m-d', $firstDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// iterate one more time setting up empty dates
- 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[]
- 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 $flat;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function iterateNodes(&$node, $currentValue, $callback)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($child['children'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function findOutStartDates(&$node)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $task
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$flat = $this->flattenRecordTasks($node['children'], $flat);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $node
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxTimeStampValue = 2147483647;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstDate = $this->iterateNodes($node, $maxTimeStampValue, function (&$child, $firstDate) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $taskStartDate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($child['start_date']) || '1970-01-01' === $child['start_date']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $task;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function flattenRecordTasks($nodes, $flat = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->rootNode = ['id' => 0];
- 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
$taskStartDate = strtotime($child['start_date']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->tasks as &$child) {
- 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
if (!isset($task['progress'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $currentValue initial result which will be evaluated if there are some child nodes like array reduce
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int timestamp
- 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 $lastDate;
- 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 (empty($closingStatuses['ProjectTask'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$status['closing']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($projectMilestone as $value) {
- 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 project data.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'or',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $firstDate;
- 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
$closingStatuses['Project'] = ['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
$this->findOutStartDates($this->rootNode);
- 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
$id = [$id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- 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
if ($taskDate > $lastDate) {
- 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
$projectMilestone = array_values(App\Fields\Picklist::getValues('projectmilestone_status'));
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
$colors['ProjectTask']['projecttaskstatus'][$value['projecttaskstatus']] = \App\Colors::get($value['color'] ?? '', $value['projecttaskstatus']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->calculateLevels();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [$this->tasksById[$id]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($id)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $node
- 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
private function calculateDurations()
- 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 (empty($closingStatuses['ProjectMilestone'])) {
- Exclude checks
Line exceeds 120 characters; contains 274 characters Open
$this->statuses['ProjectTask'][] = $status = ['value' => $value['projecttaskstatus'], 'label' => App\Language::translate($value['projecttaskstatus'], 'ProjectTask'), 'closing' => \in_array($value['projecttaskstatus'], $closingStatuses['ProjectTask']['status'])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->activeStatuses['ProjectTask'][] = $status;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->calculateDurations();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Iterate through children and search for end date.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function findOutEndDates(&$node)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskDate = strtotime($child['end_date']);
- 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
$project = array_values(App\Fields\Picklist::getValues('projectstatus'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($configColors)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addNativeCondition([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int timestamp
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastDate = $this->iterateNodes($node, 0, function (&$child, $lastDate) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($closingStatuses['Project'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($project as $value) {
- 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->statusColors = $colors;
- 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
if (!\is_array($id) && isset($this->tasksById[$id])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($viewName) {
- 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 (!empty($child['start_date']) && '1970-01-01' !== $child['start_date']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// iterate one more time setting up empty dates
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$closingStatuses['ProjectMilestone'] = ['status' => []];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$status['closing']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->statusColors = $configColors;
- 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 $lastDate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($task['duration']) && isset($task['start_date'], $task['end_date'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->activeStatuses['ProjectMilestone'][] = $status;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projectTask = array_values(App\Fields\Picklist::getValues('projecttaskstatus'));
- 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 array
- 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
});
- 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
* Calculate task duration in days.
- Exclude checks
Line exceeds 120 characters; contains 250 characters Open
$this->statuses['Project'][] = $status = ['value' => $value['projectstatus'], 'label' => App\Language::translate($value['projectstatus'], 'Project'), 'closing' => \in_array($value['projectstatus'], $closingStatuses['Project']['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
$this->statuses['ProjectMilestone'][] = $status = ['value' => $value['projectmilestone_status'], 'label' => App\Language::translate($value['projectmilestone_status'], 'ProjectMilestone'), 'closing' => \in_array($value['projectmilestone_status'], $closingStatuses['ProjectMilestone']['status'])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Prepare tasks and gather some information.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// empty id means that we want all projects
- 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->iterateNodes($node, $lastDate, function (&$child, $lastDate) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getStatuses()
- 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
$colors['ProjectTask']['projecttaskstatus'][$value['projecttaskstatus']] = \App\Colors::get($value['color'] ?? '', $value['projecttaskstatus']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addRootNode();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projects = [];
- 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
$node['end'] = $lastDate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child['end_date'] = date('Y-m-d', $lastDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['duration'] = $this->calculateDuration($task['start_date'], $task['end_date']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Collect all statuses.
- 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
$closingStatuses = Settings_RealizationProcesses_Module_Model::getStatusNotModify();
- 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
$colors['Project']['projectstatus'][$value['projectstatus']] = \App\Colors::get($value['color'] ?? '', $value['projectstatus']);
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$colors['Project']['projectstatus'][$value['projectstatus']] = \App\Colors::get($value['color'] ?? '', $value['projectstatus']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function prepareRecords()
- 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
$queryGenerator = new App\QueryGenerator('Project');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastDate = strtotime(date('Y-m-d'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($node['end_date'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === $lastDate) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child['end'] = $lastDate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($child['end_date'])) {
- 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 $lastDate;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->tasks as &$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
$closingStatuses['ProjectTask'] = ['status' => []];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$colors = ['Project' => [], 'ProjectMilestone' => [], 'ProjectTask' => []];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->activeStatuses['Project'][] = $status;
- Exclude checks
Line exceeds 120 characters; contains 307 characters Open
$this->statuses['ProjectMilestone'][] = $status = ['value' => $value['projectmilestone_status'], 'label' => App\Language::translate($value['projectmilestone_status'], 'ProjectMilestone'), 'closing' => \in_array($value['projectmilestone_status'], $closingStatuses['ProjectMilestone']['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
* @param mixed|null $viewName
- 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
private function getProject($id, $viewName = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->collectChildrens();
- 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 array|int $id project 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
if ($id !== [0]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child['start_date'] = date('Y-m-d', $firstDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $firstDate;
- 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
foreach ($projectTask as $value) {
- 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->findOutEndDates($this->rootNode);
- Exclude checks
Line exceeds 120 characters; contains 262 characters Open
$queryGenerator->setFields(['id', 'projectid', 'parentid', 'projectname', 'projectpriority', 'description', 'project_no', 'projectstatus', 'sum_time', 'startdate', 'actualenddate', 'targetenddate', 'progress', 'assigned_user_id', 'estimated_work_time']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $queryGenerator->getCustomViewQueryById($viewName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$child['start'] = date('Y-m-d H:i:s', $firstDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$node['end_date'] = date('Y-m-d', $lastDate);
- 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->statuses['Project'][] = $status = ['value' => $value['projectstatus'], 'label' => App\Language::translate($value['projectstatus'], 'Project'), 'closing' => \in_array($value['projectstatus'], $closingStatuses['Project']['status'])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->statuses['ProjectTask'][] = $status = ['value' => $value['projecttaskstatus'], 'label' => App\Language::translate($value['projecttaskstatus'], 'ProjectTask'), 'closing' => \in_array($value['projecttaskstatus'], $closingStatuses['ProjectTask']['status'])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->normalizeParents();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $taskDate;
- 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
$colors['ProjectMilestone']['projectmilestone_status'][$value['projectmilestone_status']] = \App\Colors::get($value['color'] ?? '', $value['projectmilestone_status']);
- Exclude checks
Line exceeds 120 characters; contains 179 characters Open
$colors['ProjectMilestone']['projectmilestone_status'][$value['projectmilestone_status']] = \App\Colors::get($value['color'] ?? '', $value['projectmilestone_status']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$status['closing']) {
- 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
$configColors = \App\Config::module('Project', 'defaultGanttColors');
- 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
['parentid' => $id],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['projectid' => array_diff($id, array_keys($this->tasksById))]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['end'] = strtotime($project['end_date']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed|null $viewName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projectIds = array_column($projects, 'id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestones = $this->getGanttMilestones($projectIds);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->tasks = array_merge($projects, $milestones, $ganttTasks);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'open' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['start'] = date('Y-m-d H:i:s', strtotime($row['startdate']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $projects;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ganttTasks = $this->getGanttTasks($projectIds);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $queryGenerator->createQuery();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'activeStatuses' => $this->activeStatuses,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'no' => $queryGenerator->getModuleField('project_no')->getDisplayValue($row['project_no'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$title = $project['label'];
- Exclude checks
Line exceeds 120 characters; contains 266 characters Open
'color' => ($row['projectstatus'] && isset($this->statusColors['Project']['projectstatus'][$row['projectstatus']])) ? $this->statusColors['Project']['projectstatus'][$row['projectstatus']] : \App\Colors::getRandomColor('projectstatus_' . $row['id']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($project['color']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projects[] = $project;
- 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->prepareRecords();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'progress' => (int) $row['progress'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'assigned_user_id' => $row['assigned_user_id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array projects,milestones,tasks
- 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 (!empty($this->tree) && !empty($this->tree['children'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getStatuses();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($projects as $project) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->tasks = array_merge($projects, $milestones, $ganttTasks);
- 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
'name' => $projectName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status_label' => App\Language::translate($row['projectstatus'], 'Project'),
- 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
$endDate = strtotime(date('Y-m-d', strtotime($row['targetenddate'])) . ' +1 days');
- 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
$projectIds = array_merge($projectIds, array_column($milestones, 'id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => $title
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->tree) && !empty($this->tree['children'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['tasks'] = $this->cleanup($this->flattenRecordTasks($this->tree['children']));
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$projectName = $queryGenerator->getModuleField('projectname')->getDisplayValue($row['projectname'], $row['id'], false, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'parentId' => !empty($row['parentid']) ? $row['parentid'] : null,
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
'description' => $queryGenerator->getModuleField('description')->getDisplayValue($row['description'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'color' => ($row['projectstatus'] && isset($this->statusColors['Project']['projectstatus'][$row['projectstatus']])) ? $this->statusColors['Project']['projectstatus'][$row['projectstatus']] : \App\Colors::getRandomColor('projectstatus_' . $row['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
unset($project['parentId']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['end_date'] = date('Y-m-d', $endDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['style'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fill' => $project['color'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($id !== [0] && !\in_array($row['id'], $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
'cantWriteOnParent' => false,
- 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
$projects = $this->getProject($id);
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
'normalized_status' => $queryGenerator->getModuleField('projectstatus')->getDisplayValue($row['projectstatus'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($row['startdate'])) {
- 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
'canWrite' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty((int) $id)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canDelete' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canDelete' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($project['parentId'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['target_end_date'] = $row['targetenddate'] ? date('Y-m-d', strtotime($row['targetenddate'])) : '';
- 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
$projects = $this->getProject(0, $viewName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'statusColors' => $this->statusColors,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response['tasks'] = $this->cleanup($this->flattenRecordTasks($this->tree['children']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projectIds = array_column($projects, 'id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canAdd' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'priority_label' => \App\Language::translate($row['projectpriority'] ?? '', 'Project'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['planned_duration'] = $project['estimated_work_time'];
- 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 getAllData($viewName = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canAdd' => false,
- 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|string $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cantWriteOnParent' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projectName = $queryGenerator->getModuleField('projectname')->getDisplayValue($row['projectname'], $row['id'], false, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => 'Project',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canAdd' => false,
- 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
$childrenIds[] = $row['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
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => $projectName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => 'index.php?module=Project&view=Detail&record=' . $row['id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canWrite' => false,
- Exclude checks
Line exceeds 120 characters; contains 225 characters Open
$project['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $project['no'] . '" href="' . $project['url'] . '" target="_blank" rel="noreferrer noopener">' . $project['no'] . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['dependentOn'] = [$project['parentId']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($childrenIds)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($queryGenerator, $query, $dataReader, $project);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($projects, $projectIds, $milestones, $ganttTasks);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $response;
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
'priority' => $queryGenerator->getModuleField('projectpriority')->getDisplayValue($row['projectpriority'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'estimated_work_time' => $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $project['no'] . '" href="' . $project['url'] . '" target="_blank" rel="noreferrer noopener">' . $project['no'] . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($project['end_date']) && !empty($row['targetenddate'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get all projects from the system.
- 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 getById($id)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canWrite' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'border' => $project['color']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getStatuses();
- 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
'activeStatuses' => $this->activeStatuses,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'priority' => $queryGenerator->getModuleField('projectpriority')->getDisplayValue($row['projectpriority'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- 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
'statuses' => $this->statuses,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $response;
- 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 array - projects,milestones,tasks
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($project['id'] === $id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ganttTasks = $this->getGanttTasks($projectIds);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'statusColors' => $this->statusColors,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'project',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => $queryGenerator->getModuleField('description')->getDisplayValue($row['description'], $row['id'], false, true),
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
'no' => $queryGenerator->getModuleField('project_no')->getDisplayValue($row['project_no'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['start_date'] = date('Y-m-d', strtotime($row['startdate']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$project['end_date'] = $row['actualenddate'] ?: $row['targetenddate'] ?: '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projects = array_merge($projects, $this->getProject($childrenIds, $viewName));
- 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
unset($projectIds, $milestones, $ganttTasks, $projects, $queryGenerator, $rootProjectIds, $projectIdsRows);
- 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->prepareRecords();
- 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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => $row['id'],
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
'estimated_work_time' => $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => 'STATUS_ACTIVE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cantWriteOnParent' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'normalized_status' => $queryGenerator->getModuleField('projectstatus')->getDisplayValue($row['projectstatus'], $row['id'], false, true),
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->tasksById[$row['id']] = $project;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canDelete' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get project data to display in view as gantt.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$title = '';
- 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
$milestones = $this->getGanttMilestones($projectIds);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'statuses' => $this->statuses,
- 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
$milestones = [];
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$milestoneName = $queryGenerator->getModuleField('projectmilestonename')->getDisplayValue($row['projectmilestonename'], $row['id'], false, true);
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['start_date'] = date('Y-m-d', strtotime($pmDate));
- 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
'priority_label' => \App\Language::translate($row['projecttaskpriority'] ?? '', 'ProjectTask'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'no' => $queryGenerator->getModuleField('projecttask_no')->getDisplayValue($row['projecttask_no'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get project milestones.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'open' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'normalized_status' => $queryGenerator->getModuleField('projectmilestone_status')->getDisplayValue($row['projectmilestone_status'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'no' => $queryGenerator->getModuleField('projectmilestone_no')->getDisplayValue($row['projectmilestone_no'], $row['id'], false, true),
- Exclude checks
Line exceeds 120 characters; contains 207 characters Open
$milestone['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $milestone['no'] . '" href="' . $milestone['url'] . '" target="_blank">' . $milestone['no'] . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'border' => $milestone['color']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canAdd' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'progress' => (int) $row['projecttaskprogress'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'start_date' => date('Y-m-d', strtotime($row['startdate'])),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'assigned_user_id' => $row['assigned_user_id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $task['no'] . '" href="' . $task['url'] . '" target="_blank">' . $task['no'] . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['parentId'] = $parentId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'estimated_work_time' => $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'assigned_user_id' => $row['assigned_user_id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['duration'] = 24 * 60 * 60 * 1000;
- 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' => 'STATUS_ACTIVE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getGanttMilestones($projectIds)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'startIsMilestone' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['end_date'] = date('Y-m-d', $endDate);
- 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[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'target_end_date' => $row['targetenddate'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'open' => true,
- 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
$endDate = date('Y-m-d', strtotime('+1 day', strtotime($task['end_date'])));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($dataReader, $queryGenerator, $taskTime, $endDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = new App\QueryGenerator('ProjectMilestone');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $milestoneName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canDelete' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- Exclude checks
Line exceeds 120 characters; contains 343 characters Open
'color' => ($row['projectmilestone_status'] && isset($this->statusColors['ProjectMilestone']['projectmilestone_status'][$row['projectmilestone_status']])) ? $this->statusColors['ProjectMilestone']['projectmilestone_status'][$row['projectmilestone_status']] : App\Colors::getRandomColor('projectmilestone_status_' . $row['id']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fill' => $milestone['color'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestones[] = $milestone;
- 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
$queryGenerator = new App\QueryGenerator('ProjectTask');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ganttTasks = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => 'index.php?module=ProjectTask&view=Detail&record=' . $row['id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['duration'] = $this->calculateDuration($task['start_date'], $endDate);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'priority' => $queryGenerator->getModuleField('projectmilestone_priority')->getDisplayValue($row['projectmilestone_priority'], $row['id'], false, true),
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
'priority_label' => $queryGenerator->getModuleField('projectmilestone_priority')->getDisplayValue($row['projectmilestone_priority'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canWrite' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($milestone['parentId'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($pmDate = $row['projectmilestonedate']) {
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$milestone['v'] = $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['planned_duration'] = $milestone['estimated_work_time'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get project tasks.
- Exclude checks
Line exceeds 120 characters; contains 290 characters Open
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['vtiger_projecttask.projectmilestoneid' => $projectIds]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'start' => date('Y-m-d H:i:s', strtotime($row['startdate'])),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => 'ProjectTask',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($task['parentId'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($task['color']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['planned_duration'] = $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true);
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
$task['planned_duration'] = $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true);
- 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
'parentId' => !empty($row['parentid']) ? $row['parentid'] : $row['projectid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['dependentOn'] = [$milestone['parentId']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getGanttTasks($projectIds)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskTime = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => $taskName,
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'assigned_user_name' => \App\Fields\Owner::getUserLabel($row['assigned_user_id']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$task['dependentOn'] = [$parentId];
- 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
$row['parentid'] = (int) $row['parentid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => 'ProjectMilestone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['style'] = [
- 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|int[] $projectIds
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canWrite' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cantWriteOnParent' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'priority' => $queryGenerator->getModuleField('projecttaskpriority')->getDisplayValue($row['projecttaskpriority'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'color' => ($row['projecttaskstatus'] && isset($this->statusColors['ProjectTask']['projecttaskstatus'][$row['projecttaskstatus']])) ? $this->statusColors['ProjectTask']['projecttaskstatus'][$row['projecttaskstatus']] : App\Colors::getRandomColor('projecttaskstatus_' . $row['id']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base' => [
- 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 int|int[] $projectIds
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['projectid'] = (int) $row['projectid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => $milestoneName,
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
'status_label' => $queryGenerator->getModuleField('projectmilestone_status')->getDisplayValue($row['projectmilestone_status'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'color' => ($row['projectmilestone_status'] && isset($this->statusColors['ProjectMilestone']['projectmilestone_status'][$row['projectmilestone_status']])) ? $this->statusColors['ProjectMilestone']['projectmilestone_status'][$row['projectmilestone_status']] : App\Colors::getRandomColor('projectmilestone_status_' . $row['id']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($milestone['color']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addNativeCondition([
- 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
'canDelete' => false,
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
'normalized_status' => $queryGenerator->getModuleField('projecttaskstatus')->getDisplayValue($row['projecttaskstatus'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => '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
Line exceeds 120 characters; contains 279 characters Open
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cantWriteOnParent' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['start'] = date('Y-m-d H:i:s', strtotime($pmDate));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- 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
'id' => $row['id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parentId = (int) ($row['projectmilestoneid'] ?? $row['projectid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ganttTasks[] = $task;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => $row['id'],
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
'no' => $queryGenerator->getModuleField('projectmilestone_no')->getDisplayValue($row['projectmilestone_no'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['end'] = $endDate;
- Exclude checks
Line exceeds 120 characters; contains 297 characters Open
'color' => ($row['projecttaskstatus'] && isset($this->statusColors['ProjectTask']['projecttaskstatus'][$row['projecttaskstatus']])) ? $this->statusColors['ProjectTask']['projecttaskstatus'][$row['projecttaskstatus']] : App\Colors::getRandomColor('projecttaskstatus_' . $row['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
$queryGenerator->addNativeCondition(['vtiger_projectmilestone.projectid' => $projectIds]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => 'index.php?module=ProjectMilestone&view=Detail&record=' . $row['id'],
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
'normalized_status' => $queryGenerator->getModuleField('projectmilestone_status')->getDisplayValue($row['projectmilestone_status'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status_label' => $queryGenerator->getModuleField('projectmilestone_status')->getDisplayValue($row['projectmilestone_status'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => 'STATUS_ACTIVE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['v'] = $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true);
- 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
unset($dataReader, $queryGenerator);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $milestones;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'normalized_status' => $queryGenerator->getModuleField('projecttaskstatus')->getDisplayValue($row['projecttaskstatus'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields(['id', 'parentid', 'projectid', 'projectmilestonename', 'projectmilestonedate', 'projectmilestone_no', 'projectmilestone_progress', 'projectmilestone_priority', 'sum_time', 'estimated_work_time', 'projectmilestone_status', 'assigned_user_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $queryGenerator->createQuery()->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'progress' => (int) $row['projectmilestone_progress'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'priority_label' => $queryGenerator->getModuleField('projectmilestone_priority')->getDisplayValue($row['projectmilestone_priority'], $row['id'], false, true),
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
'estimated_work_time' => $queryGenerator->getModuleField('estimated_work_time')->getDisplayValue($row['estimated_work_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestone['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $milestone['no'] . '" href="' . $milestone['url'] . '" target="_blank">' . $milestone['no'] . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endDate = strtotime(date('Y-m-d', strtotime($pmDate)) . ' +1 days');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['vtiger_projecttask.projectid' => $projectIds],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $taskName,
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
$task['number'] = '<a class="showReferenceTooltip js-popover-tooltip--record" title="' . $task['no'] . '" href="' . $task['url'] . '" target="_blank">' . $task['no'] . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$milestoneName = $queryGenerator->getModuleField('projectmilestonename')->getDisplayValue($row['projectmilestonename'], $row['id'], false, true);
- 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
'or',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskName = $queryGenerator->getModuleField('projecttaskname')->getDisplayValue($row['projecttaskname'], $row['id'], false, true);
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$taskName = $queryGenerator->getModuleField('projecttaskname')->getDisplayValue($row['projecttaskname'], $row['id'], false, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'parentId' => (int) ($row['parentid'] ?? 0),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status_label' => App\Language::translate($row['projecttaskstatus'], 'ProjectTask'),
- 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 ($parentId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $ganttTasks;
- 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
'type' => 'milestone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($milestone['parentId']);
- 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
Line exceeds 120 characters; contains 156 characters Open
'priority' => $queryGenerator->getModuleField('projecttaskpriority')->getDisplayValue($row['projecttaskpriority'], $row['id'], false, true),
- 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
'border' => $task['color']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$taskTime += $row['estimated_work_time'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return milestone[]
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
'priority' => $queryGenerator->getModuleField('projectmilestone_priority')->getDisplayValue($row['projectmilestone_priority'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sum_time' => $queryGenerator->getModuleField('sum_time')->getDisplayValue($row['sum_time'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'canAdd' => false,
- 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
$queryGenerator->setFields(['id', 'projectid', 'projecttaskname', 'parentid', 'projectmilestoneid', 'projecttaskprogress', 'projecttaskpriority', 'startdate', 'enddate', 'targetenddate', 'sum_time', 'projecttask_no', 'projecttaskstatus', 'estimated_work_time', 'assigned_user_id']);
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
'no' => $queryGenerator->getModuleField('projecttask_no')->getDisplayValue($row['projecttask_no'], $row['id'], false, true),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'end_date' => $row['enddate'] ?: $row['targetenddate'],
- 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['style'] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fill' => $task['color'],
- Exclude checks
Class name "Project_Gantt_Model" is not in camel caps format Open
class Project_Gantt_Model
- Exclude checks