Function createSerialLetterExcel
has a Cognitive Complexity of 365 (exceeds 5 allowed). Consider refactoring. Open
public function createSerialLetterExcel(TblSerialLetter $tblSerialLetter)
{
$tblPersonList = $this->getPersonAllBySerialLetter($tblSerialLetter);
$ExportData = array();
- 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 updateSerialLetter
has a Cognitive Complexity of 274 (exceeds 5 allowed). Consider refactoring. Open
public function updateSerialLetter(
IFormInterface $Stage = null,
TblSerialLetter $tblSerialLetter,
$SerialLetter = null,
$FilterGroup = 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
File Service.php
has 1300 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace SPHERE\Application\Reporting\SerialLetter;
use MOC\V\Component\Document\Component\Bridge\Repository\PhpExcel;
use MOC\V\Component\Document\Component\Parameter\Repository\FileParameter;
Function createSerialLetter
has a Cognitive Complexity of 163 (exceeds 5 allowed). Consider refactoring. Open
public function createSerialLetter(
IFormInterface $Stage = null,
$SerialLetter,
$FilterGroup = null,
$FilterPerson = 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
Function createAddressPersonGuardian
has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring. Open
public function createAddressPersonGuardian(TblSerialLetter $tblSerialLetter)
{
$tblSerialPersonList = SerialLetter::useService()->getSerialPersonBySerialLetter($tblSerialLetter);
if ($tblSerialPersonList) {
$CreateArray = array();
- 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 createSerialLetterExcel
has 291 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSerialLetterExcel(TblSerialLetter $tblSerialLetter)
{
$tblPersonList = $this->getPersonAllBySerialLetter($tblSerialLetter);
$ExportData = array();
Function setPersonAddressSelection
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
public function setPersonAddressSelection(
IFormInterface $Form,
TblSerialLetter $tblSerialLetter,
TblPerson $tblPerson,
$Check,
- 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 createAddressPersonCompany
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
public function createAddressPersonCompany(TblSerialLetter $tblSerialLetter)
{
$tblSerialPersonList = SerialLetter::useService()->getSerialPersonBySerialLetter($tblSerialLetter);
$tblType = Address::useService()->getTypeById(1);
- 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
Service
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
class Service extends AbstractService
{
/**
* @param bool $doSimulation
Function getAddressPersonAllByPerson
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function getAddressPersonAllByPerson(
TblSerialLetter $tblSerialLetter,
TblPerson $tblPerson
) {
- 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 updateSerialLetter
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateSerialLetter(
IFormInterface $Stage = null,
TblSerialLetter $tblSerialLetter,
$SerialLetter = null,
$FilterGroup = null,
Function createAddressPersonSelf
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function createAddressPersonSelf(TblSerialLetter $tblSerialLetter)
{
$tblSerialPersonList = SerialLetter::useService()->getSerialPersonBySerialLetter($tblSerialLetter);
if ($tblSerialPersonList) {
$CreateArray = array();
- 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 createSerialLetter
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSerialLetter(
IFormInterface $Stage = null,
$SerialLetter,
$FilterGroup = null,
$FilterPerson = null,
Function updateDynamicSerialCompany
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function updateDynamicSerialCompany(TblSerialLetter $tblSerialLetter, $tblCompanySearchList)
{
if (!empty($tblCompanySearchList)) {
- 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 createSerialLetterCompanyExcel
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSerialLetterCompanyExcel(TblSerialLetter $tblSerialLetter)
{
$ExportData = array();
$tblSerialCompanyList = $this->getSerialCompanyBySerialLetter($tblSerialLetter, false);
Function getSerialLetterCount
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function getSerialLetterCount(TblSerialLetter $tblSerialLetter)
{
$result = 0;
$tblSerialLetterPersonList = SerialLetter::useService()->getPersonAllBySerialLetter($tblSerialLetter);
- 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 createAddressPersonGuardian
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createAddressPersonGuardian(TblSerialLetter $tblSerialLetter)
{
$tblSerialPersonList = SerialLetter::useService()->getSerialPersonBySerialLetter($tblSerialLetter);
if ($tblSerialPersonList) {
$CreateArray = array();
Method setPersonAddressSelection
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setPersonAddressSelection(
IFormInterface $Form,
TblSerialLetter $tblSerialLetter,
TblPerson $tblPerson,
$Check,
Method updateDynamicSerialCompany
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateDynamicSerialCompany(TblSerialLetter $tblSerialLetter, $tblCompanySearchList)
{
if (!empty($tblCompanySearchList)) {
Method getAddressPersonAllByPerson
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAddressPersonAllByPerson(
TblSerialLetter $tblSerialLetter,
TblPerson $tblPerson
) {
Method createAddressPersonCompany
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createAddressPersonCompany(TblSerialLetter $tblSerialLetter)
{
$tblSerialPersonList = SerialLetter::useService()->getSerialPersonBySerialLetter($tblSerialLetter);
$tblType = Address::useService()->getTypeById(1);
Method createAddressPersonSelf
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createAddressPersonSelf(TblSerialLetter $tblSerialLetter)
{
$tblSerialPersonList = SerialLetter::useService()->getSerialPersonBySerialLetter($tblSerialLetter);
if ($tblSerialPersonList) {
$CreateArray = array();
Method createSerialLetter
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
IFormInterface $Stage = null,
$SerialLetter,
$FilterGroup = null,
$FilterPerson = null,
$FilterStudent = null,
Function updateDynamicSerialPerson
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function updateDynamicSerialPerson(TblSerialLetter $tblSerialLetter, $tblPersonSearchList)
{
if ($tblPersonSearchList) {
- 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 updateSerialLetter
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
IFormInterface $Stage = null,
TblSerialLetter $tblSerialLetter,
$SerialLetter = null,
$FilterGroup = null,
$FilterStudent = null,
Avoid deeply nested control flow statements. Open
if ($Salutation === 'Herr' || $Salutation === 'Frau') {
$isReady = false;
}
Avoid deeply nested control flow statements. Open
if (!empty($FilterYear)) {
foreach ($FilterYear as $FieldName => $FilterList) {
foreach ($FilterList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Avoid deeply nested control flow statements. Open
if (!empty($FilterRelationship)) {
foreach ($FilterRelationship as $FieldName => $FilterList) {
foreach ($FilterList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Avoid deeply nested control flow statements. Open
if (!in_array($tblAddress->getId(), $Address)) {
$result++;
}
Avoid deeply nested control flow statements. Open
if (!empty($FilterStudent)) {
foreach ($FilterStudent as $FieldName => $FilterNumberList) {
foreach ($FilterNumberList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Avoid deeply nested control flow statements. Open
if (!empty($FilterGroup)) {
foreach ($FilterGroup as $FieldName => $FilterList) {
foreach ($FilterList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
if ($SaveFilterField) {
Avoid deeply nested control flow statements. Open
if (!empty($FilterGroup)) {
foreach ($FilterGroup as $FieldName => $FilterList) {
foreach ($FilterList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Avoid deeply nested control flow statements. Open
if (!empty($FilterGroup)) {
foreach ($FilterGroup as $FieldName => $FilterList) {
foreach ($FilterList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Avoid deeply nested control flow statements. Open
if (!empty($FilterCompany)) {
foreach ($FilterCompany as $FieldName => $FilterNumberList) {
foreach ($FilterNumberList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Avoid deeply nested control flow statements. Open
if (isset($Address['PersonLastName']) && !empty($Address['PersonLastName'])) {
if (isset($Address['PersonSalutation'])
&& count($Address['PersonLastName']) > 1
) {
// Personen mit gleichem Nachnamen
Avoid deeply nested control flow statements. Open
if ($Salutation !== 'Herr' && $Salutation !== 'Frau') {
$isReady = false;
}
Avoid deeply nested control flow statements. Open
if ($tblPerson->getId() !== $tblGuardian->getServiceTblPersonFrom()->getId()) {
$GuardianList[] = $tblGuardian->getServiceTblPersonFrom();
}
Avoid deeply nested control flow statements. Open
if (!empty($ToPersonChooseList)) {
$count = 0;
foreach ($ToPersonChooseList as $ToPersonChoose) {
Avoid deeply nested control flow statements. Open
if ($Key > 2) {
break;
}
Avoid deeply nested control flow statements. Open
if ($tblToPersonList) {
$tblType = Address::useService()->getTypeById(1);
$tblToPersonChoose = null;
// Ziehen der ersten Hauptadresse
/** @var TblToPerson $tblToPerson */
Avoid deeply nested control flow statements. Open
if (!empty($FilterProspect)) {
foreach ($FilterProspect as $FieldName => $FilterNumberList) {
foreach ($FilterNumberList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Avoid deeply nested control flow statements. Open
if ($tblToCompanyList) {
foreach ($tblToCompanyList as $tblToCompany) {
if ($tblToCompany->getTblType()->getId() === $tblType->getId()) {
// $tblSalutation = $tblPerson->getTblSalutation();
$PersonTo = $tblPerson;
Avoid deeply nested control flow statements. Open
if (( $PersonToAddress = $tblToPerson->getServiceTblPerson() )) {
if (( $tblAddress = $serviceTblPersonToAddress->getTblAddress() )) {
//Person SerialLetter
$AddressList[$tblPerson->getId().$tblAddress->getId()]['Salutation'] =
$tblPerson->getSalutation();
Avoid deeply nested control flow statements. Open
if (!empty($FilterGroup)) {
foreach ($FilterGroup as $FieldName => $FilterList) {
foreach ($FilterList as $FilterNumber => $FieldValue) {
if ($FieldValue) {
( new Data($this->getBinding()) )->createFilterField($tblSerialLetter, $tblFilterCategory,
Method setPersonAddressSelection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
IFormInterface $Form,
TblSerialLetter $tblSerialLetter,
TblPerson $tblPerson,
$Check,
$Route = '/Reporting/SerialLetter/Address'
Method createAddressPerson
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TblSerialLetter $tblSerialLetter,
TblPerson $tblPerson,
TblPerson $tblPersonToAddress,
TblToPerson $tblToPerson = null,
TblToCompany $tblToCompany = null
Function getSerialLetterCompanyCount
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getSerialLetterCompanyCount(TblSerialLetter $tblSerialLetter)
{
$result = 0;
if(($tblSerialCompanyList = SerialLetter::useService()->getSerialCompanyBySerialLetter($tblSerialLetter))){
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($Address['PersonSalutation'][$Key] == 'Herr') {
$firstLetter = 'Sehr geehrter '.$Address['PersonSalutation'][$Key].' '.$LastName;
$secondLetter = 'Lieber '.$Address['PersonSalutation'][$Key].' '.$LastName;
} elseif ($Address['PersonSalutation'][$Key] == 'Frau') {
$firstLetter = 'Sehr geehrte '.$Address['PersonSalutation'][$Key].' '.$LastName;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 141.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($Address['PersonSalutation'][$Key] == 'Herr') {
$firstLetter .= ', sehr geehrter '.$Address['PersonSalutation'][$Key].' '.$LastName;
$secondLetter .= ', lieber '.$Address['PersonSalutation'][$Key].' '.$LastName;
} elseif ($Address['PersonSalutation'][$Key] == 'Frau') {
$firstLetter .= ', sehr geehrte '.$Address['PersonSalutation'][$Key].' '.$LastName;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 141.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($Address['PersonSalutation'][$Key] == 'Herr') {
$firstLetter .= ', sehr geehrter '.$Address['PersonSalutation'][$Key].' '.$LastName;
$secondLetter .= ', lieber '.$Address['PersonSalutation'][$Key].' '.$LastName;
} elseif ($Address['PersonSalutation'][$Key] == 'Frau') {
$firstLetter .= ', sehr geehrte '.$Address['PersonSalutation'][$Key].' '.$LastName;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 141.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($Address['PersonSalutation'][$Key] == 'Herr') {
$firstLetter = 'Sehr geehrter '.$Address['PersonSalutation'][$Key].' '.$LastName;
$secondLetter = 'Lieber '.$Address['PersonSalutation'][$Key].' '.$LastName;
} elseif ($Address['PersonSalutation'][$Key] == 'Frau') {
$firstLetter = 'Sehr geehrte '.$Address['PersonSalutation'][$Key].' '.$LastName;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 141.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if($Item['Salutation']){
if($Item['Salutation'] == 'Herr'){
$Item['FirstLetter'] = 'Sehr geehrter '.$Item['Salutation'].' '.($Item['Title'] ? $Item['Title'].' ': '').$Item['LastName'];
} elseif($Item['Salutation'] == 'Frau'){
$Item['FirstLetter'] = 'Sehr geehrte '.$Item['Salutation'].' '.($Item['Title'] ? $Item['Title'].' ': '').$Item['LastName'];
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 140.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if($Item['Salutation']){
if($Item['Salutation'] == 'Herr'){
$Item['SecondLetter'] = 'Lieber '.$Item['Salutation'].' '.($Item['Title'] ? $Item['Title'].' ': '').$Item['LastName'];
} elseif($Item['Salutation'] == 'Frau'){
$Item['SecondLetter'] = 'Liebe '.$Item['Salutation'].' '.($Item['Title'] ? $Item['Title'].' ': '').$Item['LastName'];
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 140.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isset($SerialLetter['Name']) && empty($SerialLetter['Name'])) {
$Stage->setError('SerialLetter[Name]', 'Bitte geben Sie einen Namen an');
$Error = true;
} else {
if (( $tblSerialLetterByName = SerialLetter::useService()->getSerialLetterByName($SerialLetter['Name']) )) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 106.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76