Showing 185 of 185 total issues
Method getHtmlBlocksHierarchy
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHtmlBlocksHierarchy($treeBlocks = [], $level = 0)
{
if (empty($treeBlocks)) {
$treeBlocks = [$this->qdbHelperRegister->getLayoutHierarchy()];
}
Method buildTreeBlocks
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildTreeBlocks($layout, $name = 'root', $alias = '')
{
$element = $this->getElementByName($name);
if ($element) {
$treeBlocks = [
Method pullData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pullData()
{
if ($this->pluginsByTypes === null) {
$this->pluginsByTypes = [];
Method getWrapperContent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getWrapperContent($ajax = false)
{
//Clean old files
// /** @var \SplFileInfo $fileInfo */
// foreach (new \DirectoryIterator($this->getQdbTempDir()) as $fileInfo) {
Avoid using undefined variables such as '$cacheEvents' which will lead to PHP notices. Open
if(empty($cacheEvents[$identifier])) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Method execute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->resourceConfig->saveConfig('dev/quickdevbar/enable', $this->status);
$output->writeln("<info>" . $this->message . "</info>");
Method pullData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pullData()
{
$request = $this->requestHttp;
$requestData = [];
$requestData[] = ['name' => 'Date sys', 'value' => date("Y-m-d H:i:s")];
Method tailFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tailFile($filepath, $lines = 1, $adaptive = true)
{
// Open file
$f = @fopen($filepath, "rb");
if ($f === false) {
Function execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute()
{
$fileKey = $this->getRequest()->getParam('log_key', '');
$output = '';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getTreeBlocksHierarchy
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getTreeBlocksHierarchy($layout)
{
//$layout = $this->getLayout();
$reflection = new \ReflectionClass($layout);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\App\Cache\Frontend\Pool $cacheFrontendPool,
\Magento\Framework\Module\ModuleListInterface $moduleList,
\Magento\Framework\Filesystem $filesystem,
array $ideList,
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
\Magento\Framework\App\Action\Context $context,
\ADM\QuickDevBar\Helper\Data $qdbHelper,
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory,
\Magento\Framework\View\LayoutFactory $layoutFactory,
\Magento\Config\Model\ResourceModel\Config $resourceConfig,
The property $_config_values is not named in camelCase. Open
class Config extends \ADM\QuickDevBar\Block\Tab\Panel
{
protected $_config_values;
protected $_appConfig;
- Read upRead up
- Exclude checks
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 $_appConfig is not named in camelCase. Open
class Config extends \ADM\QuickDevBar\Block\Tab\Panel
{
protected $_config_values;
protected $_appConfig;
- Read upRead up
- Exclude checks
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 $_mergeService is not named in camelCase. Open
class CacheCss extends \ADM\QuickDevBar\Controller\Index
{
protected $_mergeService;
- Read upRead up
- Exclude checks
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 $_resultForwardFactory is not named in camelCase. Open
class ConfigUpdate extends \ADM\QuickDevBar\Controller\Index
{
/**
* @var \Magento\Config\Model\Resource\Config
*/
- Read upRead up
- Exclude checks
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 $_hasLoaded is not named in camelCase. Open
class Translate extends \Magento\Framework\Translate
{
/**
* Checks if we have loaded our translation data.
*
- Read upRead up
- Exclude checks
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 $_layoutFactory is not named in camelCase. Open
abstract class Index extends \Magento\Backend\App\Action
{
/**
* @var \Magento\Framework\View\LayoutFactory
- Read upRead up
- Exclude checks
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 $_filePath is not named in camelCase. Open
class Debug extends \Magento\Framework\App\Helper\AbstractHelper
{
private static $_filePath;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $bt. Configured minimum length is 3. Open
public function addDump(string $output, array $bt, $ajaxReq = null)
- Read upRead up
- Exclude checks
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;
}
}
}