Function get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function get(): array
{
$response = [];
$moduleName = $this->controller->request->getModule();
$columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', '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 get
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get(): array
{
$response = [];
$moduleName = $this->controller->request->getModule();
$columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);
Missing class import via use statement (line '124', column '22'). Open
$dataReader = (new \App\Db\Query())->from('vtiger_widgets')
- 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 get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$row['name'] = \App\Language::translate($row['label'], $moduleName, false, 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 '\Vtiger_Loader' in method 'get'. Open
$widgetClass = \Vtiger_Loader::getComponentClassName('Widget', $row['type'], $moduleName);
- 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 'get'. Open
$row['name'] = \App\Language::translate($row['label'], $moduleName, false, 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\Language' in method 'get'. Open
$row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, 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 'get'. Open
$row['data'] = \App\Json::decode($row['data']);
- 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 get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, 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 assigning values to variables in if clauses and the like (line '141', column '8'). Open
public function get(): array
{
$response = [];
$moduleName = $this->controller->request->getModule();
$columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);
- 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\Module' in method 'get'. Open
->where(['tabid' => \App\Module::getModuleId($moduleName), 'type' => $this->supportedTypes])
- 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 'get'. Open
$row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, 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
Define a constant instead of duplicating this literal "label" 3 times. Open
$columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);
- 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.
Argument 3 (language)
is false
but \App\Language::translate()
takes null|string
defined at /code/app/Language.php:161
Open
$row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);
- Exclude checks
Possibly zero references to use statement for classlike/namespace OA
(\OpenApi\Annotations)
Open
use OpenApi\Annotations as OA;
- Exclude checks
Argument 3 (language)
is false
but \App\Language::translate()
takes null|string
defined at /code/app/Language.php:161
Open
$row['name'] = \App\Language::translate($row['label'], $moduleName, false, false);
- Exclude checks
Reference to constant DEFAULT_LABELS
from undeclared class \Vtiger_Widget_Model
Open
if (isset(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']])) {
- Exclude checks
Argument 3 (language)
is false
but \App\Language::translate()
takes null|string
defined at /code/app/Language.php:161
Open
$row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);
- Exclude checks
Reference to constant DEFAULT_LABELS
from undeclared class \Vtiger_Widget_Model
Open
$row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new \App\Db\Query())->from('vtiger_widgets')
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* summary="Gets a list of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* summary="Gets a list of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=200,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=200,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="`No permissions for module`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="`No sent token`, `Invalid token`, `Token has expired`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=403,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=405,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* tags={"BaseModule"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=403,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=405,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="`No permissions for module`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="`Invalid method`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* tags={"BaseModule"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Parameter(name="moduleName", description="Module name", @OA\Schema(type="string"), in="path", example="Contacts", required=true),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=401,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* response=401,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="`No sent token`, `Invalid token`, `Token has expired`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* path="/webservice/WebservicePremium/{moduleName}/Widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Get(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Parameter(name="moduleName", description="Module name", @OA\Schema(type="string"), in="path", example="Contacts", required=true),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* path="/webservice/WebservicePremium/{moduleName}/Widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Parameter(name="moduleName", description="Module name", @OA\Schema(type="string"), in="path", example="Contacts", required=true),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="`Invalid method`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"status", "result"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="integer",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relation_id" : 1,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "1" : "lastname",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "2" : "phone",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* property="result",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Widget data by specific ID",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="label", type="string", description="Widget label", example="Contacts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relatedmodule" : 4,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* },
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "action" : 1,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->orderBy(['tabid' => SORT_ASC, 'sequence' => SORT_ASC])
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* property="status",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "0" : "firstname",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "3" : "email"
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "limit" : 5,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "limit" : 5,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "switchHeader" : "-",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "switchHeader" : "-",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dataReader = (new \App\Db\Query())->from('vtiger_widgets')
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (isset(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']])) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$widgetInstance = new $widgetClass($moduleName, null, null, $row);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"status", "result"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* enum={0, 1},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Module action - Widget for specific ID - response data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="id", type="integer", description="Widget ID", example=12),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="label", type="string", description="Widget label", example="Contacts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="sequence", type="integer", description="Sequence", example=1),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "customView" : {},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "actionSelect" : "0",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "no_result_text" : "0",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relatedModuleName" : "Contacts"
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function get(): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response = [];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->where(['tabid' => \App\Module::getModuleId($moduleName), 'type' => $this->supportedTypes])
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="wcol", type="integer", description="Widget position", example=1, enum={1, 2, 3}),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="data", type="object", description="Widget specific data", example={
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relatedmodule" : 4,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "viewtype" : "List",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "orderby" : {},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"id", "type", "label", "wcol", "sequence", "name", "data"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="type", type="string", description="Widget type", example="RelatedModule"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "actionSelect" : "0",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "filter" : "-",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "orderby" : {},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relatedModuleName" : "Contacts"
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Get_Widgets_Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* enum={0, 1},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Widget_Result",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "0" : "firstname",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "2" : "phone",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['data'] = \App\Json::decode($row['data']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $response;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Module action - Data of widgets - response body",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Module action - Widget for specific ID - response data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="name", type="string", description="The translated name of the widget", example="Contacts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "3" : "email"
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* }),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="integer",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Widget_Result",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Widget data by specific ID",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="data", type="object", description="Widget specific data", example={
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relatedfields" : {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (empty($row['label'])) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="name", type="string", description="The translated name of the widget", example="Contacts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "filter" : "-",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* property="status",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"id", "type", "label", "wcol", "sequence", "name", "data"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="id", type="integer", description="Widget ID", example=12),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "1" : "lastname",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "checkbox" : "-",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* }),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['name'] = \App\Language::translate($row['label'], $moduleName, false, false);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$widgetClass = \Vtiger_Loader::getComponentClassName('Widget', $row['type'], $moduleName);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Base module - Response action - data of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Get_Widgets_Response",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="wcol", type="integer", description="Widget position", example=1, enum={1, 2, 3}),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="sequence", type="integer", description="Sequence", example=1),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "viewtype" : "List",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$moduleName = $this->controller->request->getModule();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* property="result",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response[$row['id']] = array_intersect_key($row, $columns);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\AdditionalProperties(type="object", ref="#/components/schemas/BaseModule_Widget_Result"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="type", type="string", description="Widget type", example="RelatedModule"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "customView" : {},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Base module - Response action - data of widgets",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Module action - Data of widgets - response body",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relation_id" : 1,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "checkbox" : "-",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($row = $widgetInstance->getApiData($row)) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\AdditionalProperties(type="object", ref="#/components/schemas/BaseModule_Widget_Result"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "relatedfields" : {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* },
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "action" : 1,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* "no_result_text" : "0",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $allowedMethod = ['GET'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get widgets list method.
- 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
/** @var string[] Supported widget types */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $supportedTypes = ['RelatedModule', 'Updates', 'Comments', 'DetailView'];
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
* @OA\Parameter(name="moduleName", description="Module name", @OA\Schema(type="string"), in="path", example="Contacts", required=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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @OA\Get(
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
$row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
* @OA\Property(property="name", type="string", description="The translated name of the widget", example="Contacts"),
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
* description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error",
- Exclude checks