modules/Products/models/Relation.php
Missing class import via use statement (line '17', column '16'). Open
Open
return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();
- 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 'Vtiger_Record_Model' in method 'addListPrice'. Open
Open
$productModel = Vtiger_Record_Model::getInstanceById($sourceRecordId, $sourceModuleName);
- 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 'Vtiger_Record_Model' in method 'addListPrice'. Open
Open
$relationModuleModel = Vtiger_Record_Model::getInstanceById($destinationRecordId, $relatedModuleName);
- 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
Saw unextractable annotation for comment '* @param <integer> $sourceRecordId'</integer>
Open
Open
* @param <Integer> $sourceRecordId
- Exclude checks
Saw unextractable annotation for comment '* @param <integer> $listPrice'</integer>
Open
Open
* @param <Integer> $listPrice
- Exclude checks
Saw unextractable annotation for comment '* @param <integer> $destinationRecordId'</integer>
Open
Open
* @param <Integer> $destinationRecordId
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
Open
return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();
- Exclude checks
Call to method addNativeCondition
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
Open
$queryGenerator->addNativeCondition(['vtiger_seproductsrel.setype' => 'Products', 'vtiger_seproductsrel.crmid' => $this->get('parentRecord')->getId()]);
- Exclude checks
Call to undeclared method \Vtiger_Record_Model::updateListPrice
Open
Open
return $productModel->updateListPrice($destinationRecordId, $listPrice, $relationModuleModel->get('currency_id'));
- Exclude checks
Call to method addJoin
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
Open
$queryGenerator->addJoin(['INNER JOIN', 'vtiger_seproductsrel', 'vtiger_products.productid = vtiger_seproductsrel.productid']);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Products_Relation_Model extends Vtiger_Relation_Model
- Exclude checks
The class Products_Relation_Model is not named in CamelCase. Open
Open
class Products_Relation_Model extends Vtiger_Relation_Model
{
public function isSubProduct($subProductId)
{
if ($subProductId) {
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($subProductId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param <Integer> $sourceRecordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param <Integer> $destinationRecordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function isSubProduct($subProductId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
Open
return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$queryGenerator->addNativeCondition(['vtiger_seproductsrel.setype' => 'Products', 'vtiger_seproductsrel.crmid' => $this->get('parentRecord')->getId()]);
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
return $productModel->updateListPrice($destinationRecordId, $listPrice, $relationModuleModel->get('currency_id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get parent products.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$queryGenerator = $this->getQueryGenerator();
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
Open
$queryGenerator->addNativeCondition(['vtiger_seproductsrel.setype' => 'Products', 'vtiger_seproductsrel.crmid' => $this->get('parentRecord')->getId()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$productModel = Vtiger_Record_Model::getInstanceById($sourceRecordId, $sourceModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getParentProducts()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$relationModuleModel = Vtiger_Record_Model::getInstanceById($destinationRecordId, $relatedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$queryGenerator->addJoin(['INNER JOIN', 'vtiger_seproductsrel', 'vtiger_products.productid = vtiger_seproductsrel.productid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function to add Products/Services-PriceBooks Relation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$relatedModuleName = $this->getRelationModuleModel()->get('name');
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
Open
$queryGenerator->addJoin(['INNER JOIN', 'vtiger_seproductsrel', 'vtiger_products.productid = vtiger_seproductsrel.productid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $productModel->updateListPrice($destinationRecordId, $listPrice, $relationModuleModel->get('currency_id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function addListPrice($sourceRecordId, $destinationRecordId, $listPrice)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param <Integer> $listPrice
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$sourceModuleName = $this->getParentModuleModel()->get('name');
- Exclude checks
Class name "Products_Relation_Model" is not in camel caps format Open
Open
class Products_Relation_Model extends Vtiger_Relation_Model
- Exclude checks