Method access
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function access(App\Request $request)
{
$rows = $columns = $userData = [];
foreach ($request->getArray('columns') as $key => $value) {
$columns[$key] = $value['name'];
Function access
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function access(App\Request $request)
{
$rows = $columns = $userData = [];
foreach ($request->getArray('columns') as $key => $value) {
$columns[$key] = $value['name'];
- 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 historyVisitPurpose
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function historyVisitPurpose(App\Request $request)
{
$rows = $columns = [];
foreach ($request->getArray('columns') as $key => $value) {
$columns[$key] = $value['name'];
Function historyVisitPurpose
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function historyVisitPurpose(App\Request $request)
{
$rows = $columns = [];
foreach ($request->getArray('columns') as $key => $value) {
$columns[$key] = $value['name'];
- 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 access() has an NPath complexity of 240. The configured NPath complexity threshold is 200. Open
public function access(App\Request $request)
{
$rows = $columns = $userData = [];
foreach ($request->getArray('columns') as $key => $value) {
$columns[$key] = $value['name'];
- 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 historyVisitPurpose() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function historyVisitPurpose(App\Request $request)
{
$rows = $columns = [];
foreach ($request->getArray('columns') as $key => $value) {
$columns[$key] = $value['name'];
- 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 access() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function access(App\Request $request)
{
$rows = $columns = $userData = [];
foreach ($request->getArray('columns') as $key => $value) {
$columns[$key] = $value['name'];
- 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 17 to the 15 allowed. Open
public function historyVisitPurpose(App\Request $request)
- 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
public function access(App\Request $request)
- 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
Missing class import via use statement (line '70', column '21'). Open
$userData = (new \App\Db\Query())->from(\App\Security\AdminAccess::ACCESS_TABLE_NAME)
- 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 '108', column '17'). Open
$query = (new \App\Db\Query())->from($table);
- 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 '51', column '20'). Open
$value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);
- 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 '44', column '17'). Open
$query = (new \App\Db\Query())->from($table);
- 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 using static access to class 'Settings_Vtiger_Module_Model' in method 'access'. Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(false));
- 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 historyVisitPurpose uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$conditions[] = [$fieldModel->getColumnName() => $value];
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'historyVisitPurpose'. Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(false));
- 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\Json' in method 'historyVisitPurpose'. Open
echo \App\Json::encode($result);
- 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 'access'. Open
$data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';
- 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 access uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$conditions[$fieldModel->getColumnName()] = $value;
}
- 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\Db' in method 'historyVisitPurpose'. Open
$dataReader = $query->indexBy('id')->createCommand(\App\Db::getInstance('log'))->query();
- 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\Json' in method 'access'. Open
echo \App\Json::encode($result);
- 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 "module_id" 3 times. Open
$value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);
- 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 "column" 6 times. Open
if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {
- 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.
Call to undeclared method \App\Base::getName
Open
$value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);
- Exclude checks
Call to undeclared method \App\Base::getName
Open
$data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);
- Exclude checks
Call to undeclared method \App\Base::getColumnName
Open
$conditions[$fieldModel->getColumnName()] = $value;
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from($table);
- Exclude checks
Call to undeclared method \App\Base::getTableName
Open
if ($fieldModel->getTableName() !== $table) {
- Exclude checks
Call to undeclared method \App\Base::getColumnName
Open
$data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from($table);
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getStructure
Open
$fields = $moduleModel->getStructure('visitPurpose');
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getValueFromRequest
Open
$value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);
- Exclude checks
Call to undeclared method \App\Base::getColumnName
Open
$query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getDisplayValue
Open
$data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$userData = (new \App\Db\Query())->from(\App\Security\AdminAccess::ACCESS_TABLE_NAME)
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getEditViewUrl
Open
$data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';
- Exclude checks
Call to undeclared method \App\Base::getName
Open
if ($request->has($fieldModel->getName()) && '' !== $request->get($fieldModel->getName())) {
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getValueFromRequest
Open
$value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);
- Exclude checks
Call to undeclared method \App\Base::getColumnName
Open
$value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);
- Exclude checks
Call to undeclared method \Settings_Vtiger_Module_Model::getDisplayValue
Open
$data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);
- Exclude checks
Call to undeclared method \App\Base::getTableName
Open
$value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {
$field = $fields[$columns[$order['column']]];
$query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
}
- 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 99.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {
$field = $fields[$columns[$order['column']]];
$query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
}
- 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 99.
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 Settings_AdminAccess_GetData_Action extends \App\Controller\Action
- Exclude checks
The class Settings_AdminAccess_GetData_Action is not named in CamelCase. Open
class Settings_AdminAccess_GetData_Action extends \App\Controller\Action
{
use \App\Controller\ExposeMethod;
use \App\Controller\Traits\SettingsPermission;
- 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($request->has($fieldModel->getName()) && '' !== $request->get($fieldModel->getName())) {
- Exclude checks
Spaces must 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
* Gets access configuration.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
use \App\Controller\ExposeMethod;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(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
$query->where($conditions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field = $fields[$columns[$order['column']]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$order = current($request->getArray('order', App\Purifier::ALNUM));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($resultData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['module_id' => array_keys($resultData)])->createCommand()->queryAllByGroup(2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[$moduleModel->getBaseIndex()] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must 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
$query = (new \App\Db\Query())->from($table);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
- Exclude checks
Spaces must 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
$field = $fields[$columns[$order['column']]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
header('content-type: text/json; charset=UTF-8');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('access');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($request->getArray('columns') as $key => $value) {
- 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
echo \App\Json::encode($result);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows = $columns = $userData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filter = $query->count('id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->limit($request->getInteger('length'))->offset($request->getInteger('start'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['user'] = $userData[$key] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = $moduleModel->getStructure('visitPurpose');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('historyVisitPurpose');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columns[$key] = $value['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldModel->getTableName() !== $table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$resultData = $query->indexBy('id')->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['module_id', 'user'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows = $columns = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($request->has($fieldModel->getName()) && '' !== $request->get($fieldModel->getName())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columns[$key] = $value['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->indexBy('id')->createCommand(\App\Db::getInstance('log'))->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows[] = $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = $moduleModel->getListFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions = [];
- Exclude checks
Spaces must 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
$moduleModel = Settings_Vtiger_Module_Model::getInstance($request->getModule(false));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = [$fieldModel->getColumnName() => $value];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$order = current($request->getArray('order', App\Purifier::ALNUM));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($order && isset($columns[$order['column']], $fields[$columns[$order['column']]])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[$fieldModel->getColumnName()] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($resultData as $key => $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 290 characters Open
$data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets visits purpose.
- Exclude checks
Spaces must 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 ($request->getArray('columns') as $key => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = $moduleModel->getValueFromRequest($fieldModel->getName(), $request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('datetime' === $fieldModel->getFieldDataType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'iTotalDisplayRecords' => $filter,
- Exclude checks
Spaces must 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 access(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rows[] = $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'aaData' => $rows
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions = ['and'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = ['between', $fieldModel->getColumnName(), $value[0], $value[1]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data[] = '<button type="button" class="btn btn-primary btn-sm js-show-modal" data-id="' . $row['id'] . '" title="' . \App\Language::translate('LBL_EDIT') . '" data-url="' . $moduleModel->getEditViewUrl($row['id']) . '"><span class="yfi yfi-full-editing-view"></span></button>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'draw' => $request->getInteger('draw'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
header('content-type: text/json; charset=UTF-8');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo \App\Json::encode($result);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = 'l_#__users_login_purpose';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('text' === $fieldModel->getFieldDataType()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions[] = ['like', $fieldModel->getColumnName(), $value];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filter = $query->count('id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table = \App\Security\AdminAccess::MODULES_TABLE_NAME;
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
$value = (new \App\Db\Query())->select(['module_id'])->from($fieldModel->getTableName())->where([$fieldModel->getColumnName() => $value]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userData = (new \App\Db\Query())->from(\App\Security\AdminAccess::ACCESS_TABLE_NAME)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must 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 App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->from($table);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'iTotalDisplayRecords' => $filter,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->limit($request->getInteger('length'))->offset($request->getInteger('start'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'draw' => $request->getInteger('draw'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
use \App\Controller\Traits\SettingsPermission;
- 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
$data = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = [
- 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
$result = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = explode(',', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->where($conditions);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$query->orderBy([$field->getColumnName() => \App\Db::ASC === strtoupper($order['dir']) ? \SORT_ASC : \SORT_DESC]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'aaData' => $rows
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function historyVisitPurpose(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data[] = $moduleModel->getDisplayValue($fieldModel->getName(), $row[$fieldModel->getColumnName()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Class name "Settings_AdminAccess_GetData_Action" is not in camel caps format Open
class Settings_AdminAccess_GetData_Action extends \App\Controller\Action
- Exclude checks