YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/RecordCollector/views/ConfigModal.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '54', column '22').
Open

        $configData = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linklabel' => $recordCollectorName])->scalar();

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 '\App\Language' in method 'getPageTitle'.
Open

        return \App\Language::translate($this->pageTitle, $moduleName) . ': ' . \App\Language::translate($instance->label, 'Other.RecordCollector');

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 'getPageTitle'.
Open

        return \App\Language::translate($this->pageTitle, $moduleName) . ': ' . \App\Language::translate($instance->label, 'Other.RecordCollector');

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 'Settings_Vtiger_Field_Model' in method 'getFields'.
Open

            $fields[] = Settings_Vtiger_Field_Model::init($collectorInstance->moduleName, array_merge($defaultParams, $fieldParams));

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\RecordCollector' in method 'getFields'.
Open

        $collectorInstance = \App\RecordCollector::getInstance("App\\RecordCollectors\\{$recordCollectorName}", 'Accounts');

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 'getFields'.
Open

        $configData = $configData ? \App\Json::decode($configData) : [];

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

Call to undeclared method \Settings_RecordCollector_ConfigModal_View::getViewer
Open

        $viewer = $this->getViewer($request);

Reference to undeclared property \Settings_RecordCollector_ConfigModal_View->modalIcon
Open

        $this->modalIcon = $instance->icon;

Reference to instance property moduleName from undeclared class \App\RecordCollectors\Base
Open

            $fields[] = Settings_Vtiger_Field_Model::init($collectorInstance->moduleName, array_merge($defaultParams, $fieldParams));

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

        $configData = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linklabel' => $recordCollectorName])->scalar();

Reference to instance property settingsFields from undeclared class \App\RecordCollectors\Base
Open

        foreach ($collectorInstance->settingsFields as $fieldName => $fieldParams) {

Avoid excessively long class names like Settings_RecordCollector_ConfigModal_View. Keep class name length under 40.
Open

class Settings_RecordCollector_ConfigModal_View extends \App\Controller\ModalSettings
{
    /** {@inheritdoc} */
    protected $pageTitle = 'LBL_EDIT';

LongClassName

Since: 2.9

Detects when classes or interfaces are declared with excessively long names.

Example

class ATooLongClassNameThatHintsAtADesignProblem {

}

interface ATooLongInterfaceNameThatHintsAtADesignProblem {

}

Source https://phpmd.org/rules/naming.html#longclassname

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

class Settings_RecordCollector_ConfigModal_View extends \App\Controller\ModalSettings

The class Settings_RecordCollector_ConfigModal_View is not named in CamelCase.
Open

class Settings_RecordCollector_ConfigModal_View extends \App\Controller\ModalSettings
{
    /** {@inheritdoc} */
    protected $pageTitle = 'LBL_EDIT';

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

        $this->modalIcon = $instance->icon;

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

            $fieldParams['name'] = $fieldName;

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

        foreach ($collectorInstance->settingsFields as $fieldName => $fieldParams) {

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

    protected $pageTitle = 'LBL_EDIT';

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

     * @param string $recordCollectorName

Line exceeds 120 characters; contains 124 characters
Open

        $collectorInstance = \App\RecordCollector::getInstance("App\\RecordCollectors\\{$recordCollectorName}", 'Accounts');

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

        $viewer = $this->getViewer($request);

Line exceeds 120 characters; contains 148 characters
Open

        return \App\Language::translate($this->pageTitle, $moduleName) . ': ' . \App\Language::translate($instance->label, 'Other.RecordCollector');

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

     * Function fetching fields from Record Collector and making Field Instance.

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

        $collectorInstance = \App\RecordCollector::getInstance("App\\RecordCollectors\\{$recordCollectorName}", 'Accounts');

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

    /** {@inheritdoc} */

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

    public function process(App\Request $request)

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

        $qualifiedModuleName = $request->getModule(false);

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

     * @return array

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

        $fields = [];

Line exceeds 120 characters; contains 174 characters
Open

        $defaultParams = ['uitype' => 1, 'value' => '', 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => '', 'isEditableReadOnly' => false, 'maximumlength' => '255'];

Line exceeds 120 characters; contains 186 characters
Open

        $configData = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linklabel' => $recordCollectorName])->scalar();

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

    }

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

        $defaultParams = ['uitype' => 1, 'value' => '', 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => '', 'isEditableReadOnly' => false, 'maximumlength' => '255'];

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

        $viewer->view('ConfigModal.tpl', $qualifiedModuleName);

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

    private function getFields(string $recordCollectorName): array

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

        $recordCollectorName = $request->getByType('recordCollectorName');

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

    /** {@inheritdoc} */

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

        $viewer->assign('FIELDS', $this->getFields($request->getByType('recordCollectorName')));

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

    public function getPageTitle(App\Request $request)

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

        $moduleName = $request->getModule(false);

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

    {

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

        $configData = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linklabel' => $recordCollectorName])->scalar();

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

            $fieldParams['column'] = $fieldName;

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

        $instance = Settings_RecordCollector_Module_Model::getInstance($moduleName)->getCollectors()[$recordCollectorName];

Line exceeds 120 characters; contains 123 characters
Open

        $instance = Settings_RecordCollector_Module_Model::getInstance($moduleName)->getCollectors()[$recordCollectorName];

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

            if (\array_key_exists($fieldName, $configData)) {

Line exceeds 120 characters; contains 133 characters
Open

            $fields[] = Settings_Vtiger_Field_Model::init($collectorInstance->moduleName, array_merge($defaultParams, $fieldParams));

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

    {

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

        return \App\Language::translate($this->pageTitle, $moduleName) . ': ' . \App\Language::translate($instance->label, 'Other.RecordCollector');

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

            }

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

    /** {@inheritdoc} */

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

    }

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

            $fields[] = Settings_Vtiger_Field_Model::init($collectorInstance->moduleName, array_merge($defaultParams, $fieldParams));

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

        return $fields;

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

        $configData = $configData ? \App\Json::decode($configData) : [];

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

                $fieldParams['fieldvalue'] = $configData[$fieldName];

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

        }

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

class Settings_RecordCollector_ConfigModal_View extends \App\Controller\ModalSettings

There are no issues that match your filters.

Category
Status