YetiForceCompany/YetiForceCRM

View on GitHub
app/TextParser/AmountToReturn.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Avoid using static access to class '\App\Fields\Currency' in method 'process'.
Open

        $currency = \App\Fields\Currency::getById($rows['currency']);
Severity: Minor
Found in app/TextParser/AmountToReturn.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 'process'.
Open

        $relatedRecordModel = \Vtiger_Record_Model::getInstanceById($this->textParser->recordModel->get($this->relatedModulesFields[$this->textParser->recordModel->getModuleName()]));
Severity: Minor
Found in app/TextParser/AmountToReturn.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 '\App\Fields\Double' in method 'process'.
Open

        return \App\Fields\Double::formatToDisplay($relatedRecordModel->get('sum_gross') - $this->textParser->recordModel->get('sum_gross')) . ' ' . $currency['currency_symbol'];
Severity: Minor
Found in app/TextParser/AmountToReturn.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

Argument 1 (value) is float|int but \App\Fields\Double::formatToDisplay() takes null|string defined at /code/app/Fields/Double.php:55
Open

        return \App\Fields\Double::formatToDisplay($relatedRecordModel->get('sum_gross') - $this->textParser->recordModel->get('sum_gross')) . ' ' . $currency['currency_symbol'];
Severity: Minor
Found in app/TextParser/AmountToReturn.php by phan

Reference to instance property recordModel from undeclared class \App\TextParser
Open

        $temp = $this->textParser->recordModel->getInventoryData();
Severity: Minor
Found in app/TextParser/AmountToReturn.php by phan

Reference to instance property recordModel from undeclared class \App\TextParser
Open

        $relatedRecordModel = \Vtiger_Record_Model::getInstanceById($this->textParser->recordModel->get($this->relatedModulesFields[$this->textParser->recordModel->getModuleName()]));
Severity: Minor
Found in app/TextParser/AmountToReturn.php by phan

Reference to instance property recordModel from undeclared class \App\TextParser
Open

        return \App\Fields\Double::formatToDisplay($relatedRecordModel->get('sum_gross') - $this->textParser->recordModel->get('sum_gross')) . ' ' . $currency['currency_symbol'];
Severity: Minor
Found in app/TextParser/AmountToReturn.php by phan

Line exceeds 120 characters; contains 183 characters
Open

        $relatedRecordModel = \Vtiger_Record_Model::getInstanceById($this->textParser->recordModel->get($this->relatedModulesFields[$this->textParser->recordModel->getModuleName()]));

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 $type = 'pdf';

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

        $relatedRecordModel = \Vtiger_Record_Model::getInstanceById($this->textParser->recordModel->get($this->relatedModulesFields[$this->textParser->recordModel->getModuleName()]));

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

    public $name = 'LBL_AMOUNT_TO_RETURN';

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

    {

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

    /** @var array Allowed modules */

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

    public function process()

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

     */

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

        $currency = \App\Fields\Currency::getById($rows['currency']);

Line exceeds 120 characters; contains 178 characters
Open

        return \App\Fields\Double::formatToDisplay($relatedRecordModel->get('sum_gross') - $this->textParser->recordModel->get('sum_gross')) . ' ' . $currency['currency_symbol'];

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

    /** @var mixed Parser type */

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

     * Process.

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 $allowedModules = ['FCorectingInvoice'];

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

    protected $relatedModulesFields = ['FCorectingInvoice' => 'finvoiceid'];

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

     * @return string

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

    /** @var string */

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

        $temp = $this->textParser->recordModel->getInventoryData();

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

    /** @var array Related modules fields */

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

        $rows = reset($temp);

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

        return \App\Fields\Double::formatToDisplay($relatedRecordModel->get('sum_gross') - $this->textParser->recordModel->get('sum_gross')) . ' ' . $currency['currency_symbol'];

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

    /**

There are no issues that match your filters.

Category
Status