Function createStudentsFromFile
has a Cognitive Complexity of 331 (exceeds 5 allowed). Consider refactoring. Open
public function createStudentsFromFile(
IFormInterface $Form = null,
UploadedFile $File = null,
$TypeId = null,
$YearId = 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 createStudentsFromFile
has 481 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createStudentsFromFile(
IFormInterface $Form = null,
UploadedFile $File = null,
$TypeId = null,
$YearId = null
Function createDivisionsFromFile
has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring. Open
public function createDivisionsFromFile(
IFormInterface $Form = null,
UploadedFile $File = null,
$TypeId = null,
$YearId = 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 846 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace SPHERE\Application\Transfer\Import\FuxMedia;
Function createTeachersFromFile
has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring. Open
public function createTeachersFromFile(
IFormInterface $Form = null,
UploadedFile $File = 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 createTeachersFromFile
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createTeachersFromFile(
IFormInterface $Form = null,
UploadedFile $File = null
) {
Function createCompaniesFromFile
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function createCompaniesFromFile(
IFormInterface $Form = null,
UploadedFile $File = 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 createDivisionsFromFile
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createDivisionsFromFile(
IFormInterface $Form = null,
UploadedFile $File = null,
$TypeId = null,
$YearId = null
Method createCompaniesFromFile
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createCompaniesFromFile(
IFormInterface $Form = null,
UploadedFile $File = null
) {
Avoid deeply nested control flow statements. Open
if (trim($Document->getValue($Document->getCell($Location['Wohnort'],
$RunY))) != ''
) {
$Street = trim($Document->getValue($Document->getCell($Location['Straße'],
$RunY)));
Avoid deeply nested control flow statements. Open
if ($tblLevel) {
$Division = trim($Document->getValue($Document->getCell($Location['Schüler_Klasse'],
$RunY)));
if ($Division != '') {
if (( $pos = strpos($Division, $Level) ) !== false) {
Avoid deeply nested control flow statements. Open
for ($i = 1; $i < 5; $i++) {
$subjectLanguage = trim($Document->getValue($Document->getCell($Location['Fächer_Fremdsprache'.$i],
$RunY)));
$tblSubject = false;
if ($subjectLanguage !== '') {
Avoid deeply nested control flow statements. Open
if ($enrollmentDate !== '' && date_create($enrollmentDate) !== false) {
$tblStudentTransferType = Student::useService()->getStudentTransferTypeByIdentifier('Enrollment');
Student::useService()->insertStudentTransfer(
$tblStudent,
$tblStudentTransferType,
Avoid deeply nested control flow statements. Open
if ($arriveDate !== '' && date_create($arriveDate) !== false) {
$tblStudentTransferType = Student::useService()->getStudentTransferTypeByIdentifier('Arrive');
Student::useService()->insertStudentTransfer(
$tblStudent,
$tblStudentTransferType,
Avoid deeply nested control flow statements. Open
if (trim($Document->getValue($Document->getCell($Location['Sorgeberechtigter2_Wohnort'],
$RunY))) != ''
) {
$Street = trim($Document->getValue($Document->getCell($Location['Sorgeberechtigter2_Straße'],
$RunY)));
Avoid deeply nested control flow statements. Open
if ($PhoneNumber != '') {
Phone::useService()->insertPhoneToPerson($tblPerson, $PhoneNumber,
Phone::useService()->getTypeById(1), '');
}
Avoid deeply nested control flow statements. Open
if (trim($Document->getValue($Document->getCell($Location['Sorgeberechtigter1_Wohnort'],
$RunY))) != ''
) {
$Street = trim($Document->getValue($Document->getCell($Location['Sorgeberechtigter1_Straße'],
$RunY)));
Avoid deeply nested control flow statements. Open
if ($leaveDate !== '' && date_create($leaveDate) !== false) {
$tblStudentTransferType = Student::useService()->getStudentTransferTypeByIdentifier('Leave');
Student::useService()->insertStudentTransfer(
$tblStudent,
$tblStudentTransferType,
Avoid deeply nested control flow statements. Open
if (( $company = Company::useService()->getCompanyByDescription(trim(
$Document->getValue($Document->getCell($Location['Schüler_abgebende_Schule_ID'],
$RunY)))) )
) {
$leaveSchool = $company;
Avoid deeply nested control flow statements. Open
if ($subjectReligion !== '') {
if ($subjectReligion === 'ETH') {
$tblSubject = Subject::useService()->getSubjectByAcronym('ETH');
} elseif ($subjectReligion === 'RE/e') {
$tblSubject = Subject::useService()->getSubjectByAcronym('REV');
Avoid deeply nested control flow statements. Open
if (( $company = Company::useService()->getCompanyByDescription(trim(
$Document->getValue($Document->getCell($Location['Schüler_aufnehmende_Schule_ID'],
$RunY)))) )
) {
$arriveSchool = $company;
Avoid deeply nested control flow statements. Open
for ($i = 1; $i < 3; $i++) {
$PhoneNumber = trim($Document->getValue($Document->getCell($Location['Telefon'.$i],
$RunY)));
if ($PhoneNumber != '') {
Phone::useService()->insertPhoneToPerson($tblPerson, $PhoneNumber,
Avoid deeply nested control flow statements. Open
if (preg_match_all('!\d+!', $Street, $matches)) {
$pos = strpos($Street, $matches[0][0]);
if ($pos !== null) {
$StreetName = trim(substr($Street, 0, $pos));
$StreetNumber = trim(substr($Street, $pos));
Avoid deeply nested control flow statements. Open
if ($FaxNumber != '') {
Phone::useService()->insertPhoneToPerson($tblPerson, $FaxNumber,
Phone::useService()->getTypeById(7), '');
}
Avoid deeply nested control flow statements. Open
if ($Division != '') {
if (( $pos = strpos($Division, $Level) ) !== false) {
if (strlen($Division) > ( ( $start = $pos + strlen($Level) ) )) {
$Division = substr($Division, $start);
}
Avoid deeply nested control flow statements. Open
if ($MailAddress != '') {
Mail::useService()->insertMailToPerson($tblPerson, $MailAddress,
Mail::useService()->getTypeById(1), '');
}
Avoid too many return
statements within this method. Open
return new Danger('File nicht gefunden');
Avoid too many return
statements within this method. Open
return new Danger('File nicht gefunden');
Avoid too many return
statements within this method. Open
return new Danger('File nicht gefunden');
Avoid too many return
statements within this method. Open
return new Danger('File nicht gefunden');
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($MotherLastName !== '') {
$tblPersonMotherExists = $this->usePeoplePerson()->getPersonExists(
$MotherFirstName,
$MotherLastName,
$CityCode
- 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 463.
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 ($FatherLastName !== '') {
$tblPersonFatherExists = $this->usePeoplePerson()->getPersonExists(
$FatherFirstName,
$FatherLastName,
$CityCode
- 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 463.
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 (trim($Document->getValue($Document->getCell($Location['Schüler_Wohnort'],
$RunY))) != ''
) {
$Street = trim($Document->getValue($Document->getCell($Location['Schüler_Straße'],
$RunY)));
- 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 283.
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 (trim($Document->getValue($Document->getCell($Location['Wohnort'],
$RunY))) != ''
) {
$Street = trim($Document->getValue($Document->getCell($Location['Straße'],
$RunY)));
- 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 283.
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 3 locations. Consider refactoring. Open
$Location = array(
'Lehrerkürzel' => null,
'Name' => null,
'Vorname' => null,
'Anrede' => null,
- 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 144.
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
for ($i = 1; $i < 7; $i++) {
$PhoneNumber = trim($Document->getValue($Document->getCell($Location['Kommunikation_Telefon'.$i],
$RunY)));
if ($PhoneNumber != '') {
Phone::useService()->insertPhoneToPerson($tblPerson, $PhoneNumber,
- 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 96.
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
for ($i = 1; $i < 3; $i++) {
$PhoneNumber = trim($Document->getValue($Document->getCell($Location['Telefon'.$i],
$RunY)));
if ($PhoneNumber != '') {
Phone::useService()->insertPhoneToPerson($tblPerson, $PhoneNumber,
- 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 96.
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