Showing 246 of 249 total issues
Method onInit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onInit()
{
$this->maybeUpdate();
$this->utilities = new Utilities();
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 validateMapping
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateMapping($mapping, $source)
{
$valid = true;
// Pflichtfelder prüfen
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 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 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 __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 addSettingsFields
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addSettingsFields()
{
add_settings_field(
'einsatzvw_einsatznummer_auto',
__('Mode', 'einsatzverwaltung'),
Method addSettingsFields
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addSettingsFields()
{
add_settings_field(
'einsatzvw_permalinks_base',
__('Base', '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 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
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 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
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 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 getResourceTerms
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getResourceTerms(array $names)
{
$resourcesByName = get_terms([
'name' => $names,
'taxonomy' => [Vehicle::getSlug(), ExtEinsatzmittel::getSlug()],
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');
}
Function echoVehiclesByUnit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. 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 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"