Showing 247 of 250 total issues
Function getFields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getFields()
{
if (!empty($this->cachedFields)) {
return $this->cachedFields;
}
- 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 getDateQuery
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getDateQuery(): array
{
$dateQuery = array();
if (is_numeric($this->year)) {
- 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 renderContent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function renderContent(string $content): string
{
$post = get_post();
// Bail, if the post object is empty, not a report, or the content is password protected
- 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 validateMapping
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validateMapping($mapping, $source)
{
$valid = true;
// Pflichtfelder prüfen
- 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 getAdditionalForces
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAdditionalForces(IncidentReport $report, bool $makeLinks, bool $showArchiveLinks): string
{
if (empty($report)) {
return '';
}
- 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 getVehiclesByUnitString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getVehiclesByUnitString(array $vehiclesByUnitId): string
{
if (empty($vehiclesByUnitId)) {
return '';
}
- 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 echoSettingsPage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function echoSettingsPage()
{
if (!current_user_can('manage_options')) {
wp_die(__('You do not have sufficient permissions to manage options for this site.', 'einsatzverwaltung'));
}
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($identifier, $name, $metaKey, $icon, $labelWhenActive, $labelWhenInactive)
Function analysisPage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function analysisPage()
{
if (!$this->currentSource->checkPreconditions()) {
return;
}
- 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 create_item
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function create_item($request) // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps -- overridden method
{
$params = $request->get_params();
$start_date_time = DateTimeImmutable::createFromFormat(DATE_RFC3339, $params['date_start']);
- 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
Consider simplifying this complex logical expression. Open
if ((isset($_REQUEST['action']) && -1 != $_REQUEST['action'] && 'edit' === $_REQUEST['action']) ||
(isset($_REQUEST['action2']) && -1 != $_REQUEST['action2'] && 'edit' === $_REQUEST['action2'])
) {
return isset($_REQUEST['bulk_edit']);
}
The class Core has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13. Open
class Core
{
const VERSION = '1.11.1';
const DB_VERSION = 80;
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Method echoChecklistBox
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function echoChecklistBox(WP_Taxonomy $taxonomyObject, string $fieldName, string $label, array $selectedIds, string $smallText)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(string $key, string $label, string $description, $defaultValue = false, bool $multiValue = false)
Method echoInputText
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function echoInputText(string $label, string $name, string $value, $placeholder = '', $size = 20)
Function einsatzverwaltung_register_and_execute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function einsatzverwaltung_register_and_execute(event, id, regex, msg, allowEmpty)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($key, $label, $checkboxLabel, $description, $defaultValue = false)
Function echoRadioButtons
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function echoRadioButtons($name, $options, $defaultValue)
{
$currentValue = get_option($name, $defaultValue);
foreach ($options as $value => $option) {
if ($value === $defaultValue) {
- 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 addMissingUnits
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addMissingUnits(int $postId)
{
$assignedVehicles = wp_get_post_terms($postId, Vehicle::getSlug());
if (empty($assignedVehicles) || is_wp_error($assignedVehicles)) {
return;
- 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 getVehicleString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getVehicleString(array $vehicles, bool $makeLinks, bool $showArchiveLinks): string
{
if (empty($vehicles)) {
return '';
}
- 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"