src/Admin/ReportEditScreen.php
File ReportEditScreen.php
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace abrain\Einsatzverwaltung\Admin;
use abrain\Einsatzverwaltung\Model\IncidentReport;
use abrain\Einsatzverwaltung\Types\IncidentType;
Method displayMetaBoxEinsatzdetails
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function displayMetaBoxEinsatzdetails(WP_Post $post)
{
// Use nonce for verification
wp_nonce_field('save_einsatz_details', 'einsatzverwaltung_nonce');
Method displayMetaBoxVehicles
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function displayMetaBoxVehicles(WP_Post $post)
{
$vehicleTaxonomy = get_taxonomy(Vehicle::getSlug());
if (empty($vehicleTaxonomy)) {
return;
Method addMetaBoxes
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addMetaBoxes()
{
add_meta_box(
'einsatzverwaltung_meta_box',
__('Incident details', 'einsatzverwaltung'),
Method echoVehiclesByUnit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function echoVehiclesByUnit(WP_Post $post, WP_Taxonomy $vehicleTaxonomy, array $vehicles, array $assignedVehicleIds)
{
$unitTaxObj = get_taxonomy(Unit::getSlug());
if (empty($unitTaxObj)) {
return;
Method filterIncidentCategoryDropdown
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function filterIncidentCategoryDropdown(string $output, array $parsedArgs): string
{
if (!array_key_exists('taxonomy', $parsedArgs) || $parsedArgs['taxonomy'] !== IncidentType::getSlug()) {
return $output;
}
Function echoVehiclesByUnit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
private function echoVehiclesByUnit(WP_Post $post, WP_Taxonomy $vehicleTaxonomy, array $vehicles, array $assignedVehicleIds)
{
$unitTaxObj = get_taxonomy(Unit::getSlug());
if (empty($unitTaxObj)) {
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 displayMetaBoxVehicles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function displayMetaBoxVehicles(WP_Post $post)
{
$vehicleTaxonomy = get_taxonomy(Vehicle::getSlug());
if (empty($vehicleTaxonomy)) {
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
Avoid too many return
statements within this method. Open
Open
return $vehicle->term_id;
Avoid too many return
statements within this method. Open
Open
return $newOutput;