YetiForceCompany/YetiForceCRM

View on GitHub
modules/Products/models/Relation.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '17', column '16').
Open

            return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();
Severity: Minor
Found in modules/Products/models/Relation.php by phpmd

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

        $productModel = Vtiger_Record_Model::getInstanceById($sourceRecordId, $sourceModuleName);
Severity: Minor
Found in modules/Products/models/Relation.php by phpmd

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

        $relationModuleModel = Vtiger_Record_Model::getInstanceById($destinationRecordId, $relatedModuleName);
Severity: Minor
Found in modules/Products/models/Relation.php by phpmd

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

     * @param <Integer> $sourceRecordId
Severity: Info
Found in modules/Products/models/Relation.php by phan

Saw unextractable annotation for comment '* @param <integer> $listPrice'</integer>
Open

     * @param <Integer> $listPrice
Severity: Info
Found in modules/Products/models/Relation.php by phan

Saw unextractable annotation for comment '* @param <integer> $destinationRecordId'</integer>
Open

     * @param <Integer> $destinationRecordId
Severity: Info
Found in modules/Products/models/Relation.php by phan

Call to undeclared method \App\Db\Query::select
Open

            return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();
Severity: Critical
Found in modules/Products/models/Relation.php by phan

Call to method addNativeCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
Open

        $queryGenerator->addNativeCondition(['vtiger_seproductsrel.setype' => 'Products', 'vtiger_seproductsrel.crmid' => $this->get('parentRecord')->getId()]);
Severity: Critical
Found in modules/Products/models/Relation.php by phan

Call to undeclared method \Vtiger_Record_Model::updateListPrice
Open

        return $productModel->updateListPrice($destinationRecordId, $listPrice, $relationModuleModel->get('currency_id'));
Severity: Critical
Found in modules/Products/models/Relation.php by phan

Call to method addJoin from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
Open

        $queryGenerator->addJoin(['INNER JOIN', 'vtiger_seproductsrel', 'vtiger_products.productid = vtiger_seproductsrel.productid']);
Severity: Critical
Found in modules/Products/models/Relation.php by phan

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Products_Relation_Model extends Vtiger_Relation_Model

The class Products_Relation_Model is not named in CamelCase.
Open

class Products_Relation_Model extends Vtiger_Relation_Model
{
    public function isSubProduct($subProductId)
    {
        if ($subProductId) {
Severity: Minor
Found in modules/Products/models/Relation.php by phpmd

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

        if ($subProductId) {

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param <Integer> $sourceRecordId

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param <Integer> $destinationRecordId

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    public function isSubProduct($subProductId)

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Line exceeds 120 characters; contains 135 characters
Open

            return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();

Spaces must be used to indent lines; tabs are not allowed
Open

        $queryGenerator->addNativeCondition(['vtiger_seproductsrel.setype' => 'Products', 'vtiger_seproductsrel.crmid' => $this->get('parentRecord')->getId()]);

Line exceeds 120 characters; contains 122 characters
Open

        return $productModel->updateListPrice($destinationRecordId, $listPrice, $relationModuleModel->get('currency_id'));

Spaces must be used to indent lines; tabs are not allowed
Open

     * Get parent products.

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        $queryGenerator = $this->getQueryGenerator();

Line exceeds 120 characters; contains 160 characters
Open

        $queryGenerator->addNativeCondition(['vtiger_seproductsrel.setype' => 'Products', 'vtiger_seproductsrel.crmid' => $this->get('parentRecord')->getId()]);

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        $productModel = Vtiger_Record_Model::getInstanceById($sourceRecordId, $sourceModuleName);

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getParentProducts()

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        $relationModuleModel = Vtiger_Record_Model::getInstanceById($destinationRecordId, $relatedModuleName);

Spaces must be used to indent lines; tabs are not allowed
Open

        $queryGenerator->addJoin(['INNER JOIN', 'vtiger_seproductsrel', 'vtiger_products.productid = vtiger_seproductsrel.productid']);

Spaces must be used to indent lines; tabs are not allowed
Open

            return (new \App\Db\Query())->select(['crmid'])->from('vtiger_seproductsrel')->where(['crmid' => $subProductId])->exists();

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to add Products/Services-PriceBooks Relation.

Spaces must be used to indent lines; tabs are not allowed
Open

        $relatedModuleName = $this->getRelationModuleModel()->get('name');

Line exceeds 120 characters; contains 135 characters
Open

        $queryGenerator->addJoin(['INNER JOIN', 'vtiger_seproductsrel', 'vtiger_products.productid = vtiger_seproductsrel.productid']);

Spaces must be used to indent lines; tabs are not allowed
Open

        return $productModel->updateListPrice($destinationRecordId, $listPrice, $relationModuleModel->get('currency_id'));

Spaces must be used to indent lines; tabs are not allowed
Open

    public function addListPrice($sourceRecordId, $destinationRecordId, $listPrice)

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param <Integer> $listPrice

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

        $sourceModuleName = $this->getParentModuleModel()->get('name');

Class name "Products_Relation_Model" is not in camel caps format
Open

class Products_Relation_Model extends Vtiger_Relation_Model

There are no issues that match your filters.

Category
Status