Method __construct
has 457 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($class)
{
$this->class = $class;
$this->texts = [
'constructor_data' => [
File DeCaptchaWiki.php
has 724 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace jumper423\decaptcha\core;
/**
Method viewExamples
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function viewExamples()
{
$class = $this->class;
$reflection = (new \ReflectionClass($class));
Function viewFields
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function viewFields()
{
$class = $this->class;
$str = " {$this->getText(['table', 'th', 'name'])} | {$this->getText(['table', 'th', 'code'])} | {$this->getText(['table', 'th', 'type'])} | {$this->getText(['table', 'th', 'req'])} | {$this->getText(['table', 'th', 'def'])} | {$this->getText(['table', 'th', 'enum'])} | {$this->getText(['table', 'th', 'desc'])} ".PHP_EOL;
$str .= ' --- | --- | --- | --- | --- | --- | --- '.PHP_EOL;
- 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 view
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function view()
{
$str = $this->getText(['service', 'name']).PHP_EOL;
$str .= '=============='.PHP_EOL;
$str .= "{$this->getText(['slug', 'menu'])}".PHP_EOL;
Function getText
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getText($name, $separator = '; ')
{
$getResult = function ($name, $texts) {
if (is_array($name)) {
$name = implode('_', $name);
- 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
Avoid too many return
statements within this method. Open
return $result;
Missing class import via use statement (line '624', column '28'). Open
$reflection = (new \ReflectionClass($class));
- Read upRead up
- Exclude checks
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
Missing class import via use statement (line '550', column '28'). Open
$reflection = (new \ReflectionClass($class));
- Read upRead up
- Exclude checks
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
Missing class import via use statement (line '769', column '21'). Open
return (new \ReflectionClass($class))->getShortName().'-'.$lang.'.md';
- Read upRead up
- Exclude checks
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
Missing class import via use statement (line '720', column '27'). Open
$constants = (new \ReflectionClass($class))->getConstants();
- Read upRead up
- Exclude checks
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();
}