Showing 198 of 250 total issues
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 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 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 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');
}
Method savePostdata
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function savePostdata(int $postId, WP_Post $post)
{
// Schreibrechte prüfen
if (!current_user_can('edit_einsatzbericht', $postId)) {
return;
Function savePostdata
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function savePostdata(int $postId, WP_Post $post)
{
// Schreibrechte prüfen
if (!current_user_can('edit_einsatzbericht', $postId)) {
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 upgrade180
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function upgrade180()
{
// Rewrite post_type to evw_legacy_unit
global $wpdb;
$query = $wpdb->prepare("UPDATE $wpdb->posts SET post_type = %s WHERE post_type = %s", 'evw_legacy_unit', 'evw_unit');
- 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 enqueueEditScripts
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function enqueueEditScripts($hook)
{
if ('post.php' == $hook || 'post-new.php' == $hook) {
// Nur auf der Bearbeitungsseite anzeigen
wp_enqueue_script(
Method form
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function form($instance): string
{
$values = wp_parse_args($instance, $this->defaults);
echo '<p>';
Update
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Update
{
/**
* Fürt ein Update der Datenbank duch
*
AbstractSource
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractSource
{
/**
* @var Utilities
*/
Method upgrade120
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function upgrade120()
{
global $wpdb;
// Alle veröffentlichten Einsatzberichte einer Kategorie hinzufügen, wenn diese in den Einstellungen für die
Method echoSettingsPage
has 51 lines of code (exceeds 25 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'));
}
Method displayMetaBoxVehicles
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function displayMetaBoxVehicles(WP_Post $post)
{
$vehicleTaxonomy = get_taxonomy(Vehicle::getSlug());
if (empty($vehicleTaxonomy)) {
return;
Method registerSettings
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function registerSettings()
{
register_setting(
'einsatzvw_settings_report',
'einsatzvw_einsatz_hideemptydetails',