Missing class import via use statement (line '42', column '15'). Open
throw new \Api\Core\Exception('No permissions to view record', 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
Avoid using static access to class '\CustomView_Record_Model' in method 'get'. Open
foreach (\CustomView_Record_Model::getAll($moduleName, false) as $cvId => $recordModel) {
- 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\CustomView' in method 'checkPermission'. Open
$this->customView = \App\CustomView::getInstance($this->controller->request->getModule());
- 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
$response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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
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 {
foreach (\CustomView_Record_Model::getAll($moduleName, false) as $cvId => $recordModel) {
$response[$cvId] = array_intersect_key($recordModel->getData(), $columns);
$response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
$response[$cvId]['isFeatured'] = $recordModel->isFeatured();
- 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\Purifier' in method 'get'. Open
$response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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 '\CustomView_Record_Model' in method 'get'. Open
$recordModel = \CustomView_Record_Model::getInstanceById($this->cvId);
- 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
$response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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\Purifier' in method 'get'. Open
$response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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
Define a constant instead of duplicating this literal "viewname" 3 times. Open
$columns = array_flip(['cvid', 'viewname', 'entitytype', 'sequence', 'description', '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.
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
$response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
- Exclude checks
Argument 3 (language)
is false
but \App\Language::translate()
takes null|string
defined at /code/app/Language.php:161
Open
$response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
- 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", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* summary="List of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Gets a list of custom view",
- 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
* @OA\Get(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* summary="List of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* path="/webservice/WebserviceStandard/{moduleName}/CustomView",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* path="/webservice/WebserviceStandard/{moduleName}/CustomView",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of custom view",
- 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="`Invalid method`",
- 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
* in="path",
- 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
* @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_CustomViewById_Response"),
- 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
* type="object",
- 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\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="List of custom view",
- 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
* @OA\Response(
- 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
* description="`No permissions for module`",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Gets data of custom view",
- 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
* tags={"BaseModule"},
- 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 to view record` OR `No permissions for module or data provided in the request`",
- 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\JsonContent(ref="#/components/schemas/Exception"),
- 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
* required={"status", "result"},
- 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
* ),
- 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
* @OA\Parameter(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Custom view ID",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_CustomViewById_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
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- 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
* description="`Invalid method`",
- 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
* description="Module action - Data of custom view list - response body",
- 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
* operationId="Api\WebserviceStandard\BaseModule\CustomView::get(cvId)",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Gets data of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* example=12,
- 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
* description="`No permissions to view record` OR `No permissions for module or data provided in the request`",
- 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
* description="Gets a list of custom view",
- 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
* example=12,
- 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
* property="result",
- 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\JsonContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* path="/webservice/WebserviceStandard/{moduleName}/CustomView/{cvId}",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(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
* @OA\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Data of custom view",
- 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
* description="Module action - Data of custom view list - response body",
- 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="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_CustomView_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
* ),
- 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
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* in="path",
- 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
* 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\Property(property="status", type="integer", enum={0, 1}, 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
* description="List of custom view",
- 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
* ),
- 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\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
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="status", type="integer", enum={0, 1}, 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
* 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
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- 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
* @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_CustomView_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
* response=403,
- 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\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
* @OA\Parameter(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Schema(type="integer"),
- 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
* response=401,
- 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
* path="/webservice/WebserviceStandard/{moduleName}/CustomView/{cvId}",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required=true
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Data of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_CustomViewById_Response"),
- 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\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Get_CustomView_Response",
- 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
* security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},
- 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
* @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
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* operationId="Api\WebserviceStandard\BaseModule\CustomView::get(cvId)",
- 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
* schema="BaseModule_Get_CustomView_Response",
- 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
* description="List of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_CustomView_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
* @OA\XmlContent(ref="#/components/schemas/Exception"),
- 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
* type="object",
- 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
* type="object",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
- 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\Response(
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* name="cvId",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* name="cvId",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required=true
- 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\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
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Base module - Response action - data of custom view list",
- 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
* description="Module action - custom view for specific ID - response body",
- 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="isFeatured", type="boolean", description="Custom view is in favorites", example=false),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Module action - custom view for specific ID - response body",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ref="#/components/schemas/BaseModule_CustomViewById_Result",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="cvid", type="integer", description="Custom view ID", example=12),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_CustomView_Response"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\AdditionalProperties(type="object", ref="#/components/schemas/BaseModule_CustomViewById_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
* description="Data of custom view",
- 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
*/
- 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
public function get(): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Custom view ID",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach (\CustomView_Record_Model::getAll($moduleName, false) as $cvId => $recordModel) {
- 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/BaseModule_Get_CustomViewById_Response"),
- 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
* title="Base module - Response action - data of custom view list",
- 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
* schema="BaseModule_CustomViewById_Result",
- 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
$columns = array_flip(['cvid', 'viewname', 'entitytype', 'sequence', 'description', 'color']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response[$cvId]['isDefault'] = $defaultId === $recordModel->getId();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Get_CustomViewById_Response",
- 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="color", type="string", description="Color for custom view", example="#c28306"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$defaultId = $this->customView->getViewId(true);
- 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\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
* response=405,
- 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
* summary="Data of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* summary="Data of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),
- 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
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="status", type="integer", enum={0, 1}, 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
* description="Module action - custom view for specific ID - response data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"cvid", "viewname", "entitytype", "sequence", "description", "color", "isFeatured", "isDefault"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="color", type="string", description="Color for custom view", example="#c28306"),
- 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
* required={"status", "result"},
- 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
* @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(property="isDefault", type="boolean", description="Custom view is default", example=false),
- 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
$recordModel = \CustomView_Record_Model::getInstanceById($this->cvId);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response['isFeatured'] = $recordModel->isFeatured();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response[$cvId]['isFeatured'] = $recordModel->isFeatured();
- 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="Data of custom view",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_CustomViewById_Result",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="isFeatured", type="boolean", description="Custom view is in favorites", example=false),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response[$cvId] = array_intersect_key($recordModel->getData(), $columns);
- 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\Property(property="isDefault", type="boolean", description="Custom view is default", example=false),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="entitytype", type="string", description="Module name", example="Accounts"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="description", type="string", description="Custom view description", example="Description"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($this->cvId) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* description="Module action - custom view for specific ID - response data",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* required={"cvid", "viewname", "entitytype", "sequence", "description", "color", "isFeatured", "isDefault"},
- 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
* @OA\AdditionalProperties(type="object", ref="#/components/schemas/BaseModule_CustomViewById_Result"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Base module - Response action - data of custom view by specific ID",
- 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(
- 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="Data of custom view by specific ID",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="description", type="string", description="Custom view description", example="Description"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* title="Base module - Response action - data of custom view by specific ID",
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="status", type="integer", enum={0, 1}, 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
* ref="#/components/schemas/BaseModule_CustomViewById_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
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="viewname", type="string", description="Custom view name", example="Test 1"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="viewname", type="string", description="Custom view name", example="Test 1"),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response = array_intersect_key($recordModel->getData(), $columns);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response['isDefault'] = $defaultId === $recordModel->getId();
- 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
* ),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* schema="BaseModule_Get_CustomViewById_Response",
- 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={"status", "result"},
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="cvid", type="integer", description="Custom view ID", example=12),
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @OA\Property(property="entitytype", type="string", description="Module name", example="Accounts"),
- 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
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
* type="object",
- 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
* title="Data of custom view by specific ID",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $allowedHeaders = ['x-cv-id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Custom view 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 ($this->controller->request->has('record')) {
- Exclude checks
Spaces must 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
$this->customView = \App\CustomView::getInstance($this->controller->request->getModule());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $cvId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @api
- Exclude checks
Spaces must 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 \App\CustomView Custom view instance. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->cvId = $this->controller->request->getInteger('record');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->customView->isPermittedCustomView($this->cvId)) {
- 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
/** {@inheritdoc} */
- 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
throw new \Api\Core\Exception('No permissions to view record', 403);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @OA\Get(
- Exclude checks
Spaces must 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
protected $customView;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::checkPermission();
- Exclude checks
Spaces must 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 145 characters Open
* @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
* description="`No permissions to view record` OR `No permissions for module or data provided in the request`",
- Exclude checks
Line exceeds 120 characters; contains 189 characters Open
* @OA\Property(property="status", type="integer", enum={0, 1}, 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 to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function checkPermission(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get custom view list method.
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
* @OA\Parameter(name="moduleName", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
* @OA\Property(property="isFeatured", type="boolean", description="Custom view is in favorites", example=false),
- Exclude checks
Line exceeds 120 characters; contains 189 characters Open
* @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
* @OA\Property(property="description", type="string", description="Custom view description", example="Description"),
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
- Exclude checks