Showing 151 of 250 total issues
File Update.php
has 484 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace abrain\Einsatzverwaltung;
use WP_Error;
use WP_User;
File Formatter.php
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace abrain\Einsatzverwaltung\Util;
use abrain\Einsatzverwaltung\Frontend\AnnotationIconBar;
use abrain\Einsatzverwaltung\Model\IncidentReport;
Function format
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private function format(?WP_Post $post, string $pattern, string $tag, $context = 'post'): string
{
if ($post == null && !in_array($tag, $this->tagsNotNeedingPost)) {
return $pattern;
}
- 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
File ReportEditScreen.php
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace abrain\Einsatzverwaltung\Admin;
use abrain\Einsatzverwaltung\Model\IncidentReport;
use abrain\Einsatzverwaltung\Types\IncidentType;
Method renderToolPage
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderToolPage()
{
$this->helper = new Helper($this->utilities, $this->data);
$this->helper->metaFields = IncidentReport::getMetaFields();
$this->helper->taxonomies = IncidentReport::getTerms();
Function renderToolPage
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function renderToolPage()
{
$this->helper = new Helper($this->utilities, $this->data);
$this->helper->metaFields = IncidentReport::getMetaFields();
$this->helper->taxonomies = IncidentReport::getTerms();
- 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 format
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function format(?WP_Post $post, string $pattern, string $tag, $context = 'post'): string
{
if ($post == null && !in_array($tag, $this->tagsNotNeedingPost)) {
return $pattern;
}
IncidentReport
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class IncidentReport
{
/**
* Wenn es sich um einen bestehenden Beitrag handelt, ist hier das WordPress-Beitragsobjekt gespeichert.
*
File Helper.php
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace abrain\Einsatzverwaltung\Import;
use abrain\Einsatzverwaltung\Data;
use abrain\Einsatzverwaltung\Exceptions\ImportException;
File Renderer.php
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace abrain\Einsatzverwaltung\Frontend\ReportList;
use abrain\Einsatzverwaltung\Frontend\AnnotationIconBar;
use abrain\Einsatzverwaltung\Model\IncidentReport;
Function doUpdate
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function doUpdate(int $currentDbVersion, int $targetDbVersion)
{
if (empty($targetDbVersion)) {
return new WP_Error('', 'Zieldatenbankversion darf nicht leer sein');
}
- 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 registerPostMeta
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function registerPostMeta()
{
register_meta('post', 'einsatz_einsatzende', array(
'object_subtype' => self::getSlug(),
'type' => 'string',
Function getCellContent
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function getCellContent($report, $colId, Parameters $parameters): 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
Method displayMetaBoxEinsatzdetails
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function displayMetaBoxEinsatzdetails(WP_Post $post)
{
// Use nonce for verification
wp_nonce_field('save_einsatz_details', 'einsatzverwaltung_nonce');
Method getCellContent
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getCellContent($report, $colId, Parameters $parameters): string
{
if (empty($report)) {
return ' ';
}
Method register_routes
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register_routes() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps -- overridden method
{
$namespace = 'einsatzverwaltung/v1';
register_rest_route($namespace, '/reports', array(
array(
File RecentIncidentsFormatted.php
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace abrain\Einsatzverwaltung\Widgets;
use abrain\Einsatzverwaltung\ReportQuery;
use abrain\Einsatzverwaltung\Types\Unit;
File IncidentReport.php
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace abrain\Einsatzverwaltung\Model;
use abrain\Einsatzverwaltung\Types\AlertingMethod;
Function readFile
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function readFile($numLines = null, $requestedFields = array())
{
$fieldMap = array();
if (!empty($requestedFields)) {
$fields = $this->getFields();
- 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 doUpdate
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doUpdate(int $currentDbVersion, int $targetDbVersion)
{
if (empty($targetDbVersion)) {
return new WP_Error('', 'Zieldatenbankversion darf nicht leer sein');
}