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;
The class Helper has an overall complexity of 64 which is very high. The configured complexity threshold is 50. Open
class Helper
{
/**
* @var Utilities
*/
- Exclude checks
Method renderMatchForm
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderMatchForm($source, $args)
{
$defaults = array(
'mapping' => array(),
'next_action' => null,
Function mapEntryToInsertArgs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function mapEntryToInsertArgs($mapping, $sourceEntry, &$insertArgs)
{
foreach ($mapping as $sourceField => $ownField) {
if (empty($ownField) || !is_string($ownField)) {
$this->utilities->printError("Feld '$ownField' ungültig");
- 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 prepareArgsForInsertPost
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareArgsForInsertPost(&$insertArgs, $dateTimeFormat, $postStatus, $alarmzeit)
{
// Datum des Einsatzes prüfen
if (false === $alarmzeit) {
throw new ImportPreparationException(sprintf(
Method dropdownEigeneFelder
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function dropdownEigeneFelder($args)
{
$defaults = array(
'name' => null,
'selected' => '-',
Function renderMatchForm
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function renderMatchForm($source, $args)
{
$defaults = array(
'mapping' => array(),
'next_action' => null,
- 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 validateMapping
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateMapping($mapping, $source)
{
$valid = true;
// Pflichtfelder prüfen
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 validateMapping
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validateMapping($mapping, $source)
{
$valid = true;
// Pflichtfelder prüfen
- 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 runImport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function runImport($preparedInsertArgs, $source, $yearsAffected, $importStatus)
{
// Für die Dauer des Imports sollen die laufenden Nummern nicht aktuell gehalten werden, da dies die Performance
// stark beeinträchtigt
if ($source->isPublishReports()) {
- 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"