Showing 151 of 250 total issues
Function updateSequenceNumbers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function updateSequenceNumbers($yearToUpdate = null)
{
if (empty($yearToUpdate)) {
$years = self::getYearsWithReports();
}
- 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 getLabels
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getLabels(): array
{
return array(
'name' => _x('Incident Reports', 'post type general name', 'einsatzverwaltung'),
'singular_name' => _x('Incident Report', 'post type singular name', 'einsatzverwaltung'),
Method widget
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function widget($args, $instance)
{
$settings = wp_parse_args($instance, $this->defaults);
$title = empty($settings['title']) ? $this->defaultTitle : $settings['title'];
$filteredTitle = apply_filters('widget_title', $title);
Method onInit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onInit()
{
$this->maybeUpdate();
$this->utilities = new Utilities();
Method registerSettings
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function registerSettings()
{
register_setting(
'einsatzvw_settings_advanced',
'einsatzvw_rewrite_slug',
Method validateMapping
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateMapping($mapping, $source)
{
$valid = true;
// Pflichtfelder prüfen
Method create_item
has 29 lines of code (exceeds 25 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']);
Method checkPreconditions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkPreconditions()
{
$this->fileHasHeadlines = (bool) Utilities::getArrayValueIfKey($this->args, 'has_headlines', false);
$delimiter = Utilities::getArrayValueIfKey($this->args, 'delimiter', false);
Method filterIncidentCategoryDropdown
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function filterIncidentCategoryDropdown(string $output, array $parsedArgs): string
{
if (!array_key_exists('taxonomy', $parsedArgs) || $parsedArgs['taxonomy'] !== IncidentType::getSlug()) {
return $output;
}
Method __construct
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(Data $data, Options $options, Utilities $utilities, PermalinkController $permalinkController)
{
$pluginBasename = Core::$pluginBasename;
add_action('admin_menu', array($this, 'hideTaxonomies'));
add_action('admin_notices', array($this, 'displayAdminNotices'));
Method render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(int $postId, $annotationIds = array()): string
{
$annotationRepository = ReportAnnotationRepository::getInstance();
$string = '';
$annotations = array();
Method addSettingsFields
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addSettingsFields()
{
add_settings_field(
'einsatzvw_einsatznummer_auto',
__('Mode', 'einsatzverwaltung'),
Method getVehiclesByUnitString
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getVehiclesByUnitString(array $vehiclesByUnitId): string
{
if (empty($vehiclesByUnitId)) {
return '';
}
Function getTypesOfAlerting
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getTypesOfAlerting(IncidentReport $report, bool $makeLinks): 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 constructList
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function constructList($reports, Parameters $parameters)
{
if (empty($reports)) {
$this->string = sprintf(
'<span>%s</span>',
- 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 getMetaQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getMetaQuery(): array
{
$metaQuery = [];
if ($this->onlySpecialReports) {
- 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 prepareArgsForInsertPost
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function prepareArgsForInsertPost(&$insertArgs, $dateTimeFormat, $postStatus, $alarmzeit)
{
// Datum des Einsatzes prüfen
if (false === $alarmzeit) {
throw new ImportPreparationException(sprintf(
- 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 getTypesOfAlerting
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTypesOfAlerting(IncidentReport $report, bool $makeLinks): string
{
if (empty($report)) {
return '';
}
Method echoFieldColumns
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function echoFieldColumns()
{
$columnRepository = ColumnRepository::getInstance();
$columnIdentifiers = explode(',', get_option('einsatzvw_list_columns', ''));
$enabledColumns = $columnRepository->getColumnsByIdentifier($columnIdentifiers);
Method upgrade113
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function upgrade113()
{
if (!function_exists('get_editable_roles')) {
require_once(ABSPATH . 'wp-admin/includes/user.php');
}