vpietri/magento2-developer-quickdevbar

View on GitHub
Block/Tab/Panel.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '73', column '23').
Open

            throw new \Exception('property qdbDataKey is not defined.');
Severity: Minor
Found in Block/Tab/Panel.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

The method isAjax has a boolean flag argument $asString, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function isAjax($asString = true)
Severity: Minor
Found in Block/Tab/Panel.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid assigning values to variables in if clauses and the like (line '83', column '23').
Open

    public function getTitle()
    {
        $title = $this->getData('title');
        if(!$title && $title = $this->getDataKey()) {
            return ucfirst($title);
Severity: Minor
Found in Block/Tab/Panel.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid variables with short names like $id. Configured minimum length is 3.
Open

        $id = ($this->getData('id')) ? $this->getData('id') : $this->getNameInLayout();
Severity: Minor
Found in Block/Tab/Panel.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $bt. Configured minimum length is 3.
Open

    public function formatTrace(array $bt)
Severity: Minor
Found in Block/Tab/Panel.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

The property $_frontUrl is not named in camelCase.
Open

class Panel extends \Magento\Framework\View\Element\Template
{
    protected $_mainTabs;
    protected $_frontUrl;

Severity: Minor
Found in Block/Tab/Panel.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $_mainTabs is not named in camelCase.
Open

class Panel extends \Magento\Framework\View\Element\Template
{
    protected $_mainTabs;
    protected $_frontUrl;

Severity: Minor
Found in Block/Tab/Panel.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The method _toHtml is not named in camelCase.
Open

    protected function _toHtml()
    {
        try {
            $buffer = parent::_toHtml();
            return $this->sanitizeOutput($buffer);
Severity: Minor
Found in Block/Tab/Panel.php by phpmd

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status