modules/Project/actions/GanttData.php
Missing class import via use statement (line '22', column '14'). Open
Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);
- 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 '33', column '16'). Open
Open
$gantt = new Project_Gantt_Model();
- 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 '39', column '19'). Open
Open
$response = new Vtiger_Response();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$data = $gantt->getById($request->getInteger('projectId'));
}
- 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
Argument 1 (mixed)
is string
but \Users_Privileges_Model::hasModulePermission()
takes int
defined at /code/modules/Users/models/Privileges.php:101
Open
Open
if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission($request->getModule())) {
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Project_GanttData_Action extends \App\Controller\Action
- Exclude checks
The class Project_GanttData_Action is not named in CamelCase. Open
Open
class Project_GanttData_Action extends \App\Controller\Action
{
/**
* Function to check permission.
*
- 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
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModulePermission($request->getModule())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$data = $gantt->getById($request->getInteger('projectId'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function to check permission.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param \App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$data = $gantt->getAllData($request->getByType('viewname', 2));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$response->emit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!$request->has('projectId')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function checkPermission(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 403);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Process.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$gantt = new Project_Gantt_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @throws \App\Exceptions\NoPermitted
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param \App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$response = new Vtiger_Response();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$response->setResult($data);
- Exclude checks
Class name "Project_GanttData_Action" is not in camel caps format Open
Open
class Project_GanttData_Action extends \App\Controller\Action
- Exclude checks