File Service.php
has 803 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace SPHERE\Application\People\Meta\Student;
use SPHERE\Application\Corporation\Company\Company;
use SPHERE\Application\Corporation\Company\Service\Entity\TblCompany;
Function updateStudentGeneral
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
public function updateStudentGeneral(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
- 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 updateStudentSubject
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
public function updateStudentSubject(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
- 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 getCurrentMainDivisionByPerson
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
public function getCurrentMainDivisionByPerson(TblPerson $tblPerson)
{
if (Group::useService()->existsGroupPerson(Group::useService()->getGroupByMetaTable('STUDENT'),
$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
Service
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class Service extends Support
{
/**
* @return false|ViewStudent[]
Method updateStudentTransfer
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateStudentTransfer(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
Method updateStudentGeneral
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateStudentGeneral(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
Function getCurrentDivisionListByPerson
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function getCurrentDivisionListByPerson(TblPerson $tblPerson)
{
$tblDivisionList = array();
if (Group::useService()->existsGroupPerson(Group::useService()->getGroupByMetaTable('STUDENT'),
- 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 getMainDivisionByPersonAndYear
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function getMainDivisionByPersonAndYear(TblPerson $tblPerson, TblYear $tblYear)
{
$tblDivisionStudentList = Division::useService()->getDivisionStudentAllByPerson($tblPerson);
if ($tblDivisionStudentList) {
- 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 updateStudentSubject
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateStudentSubject(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
Function updateStudentTransfer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function updateStudentTransfer(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
- 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 updateStudentProcess
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateStudentProcess(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
Method updateStudentMedicalRecord
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateStudentMedicalRecord(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
Function getDivisionListByPersonAndYear
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getDivisionListByPersonAndYear(TblPerson $tblPerson, TblYear $tblYear)
{
$tblDivisionList = 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 createStudent
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
TblPerson $tblPerson,
$Prefix = '',
$Identifier = '',
TblStudentMedicalRecord $tblStudentMedicalRecord = null,
TblStudentTransport $tblStudentTransport = null,
Method getCurrentMainDivisionByPerson
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCurrentMainDivisionByPerson(TblPerson $tblPerson)
{
if (Group::useService()->existsGroupPerson(Group::useService()->getGroupByMetaTable('STUDENT'),
$tblPerson)
Method updateStudentBasic
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateStudentBasic(TblPerson $tblPerson, $Meta)
{
$tblStudent = $tblPerson->getStudent(true);
Method insertStudentIntegration
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
TblPerson $IntegrationPerson = null,
TblCompany $IntegrationCompany = null,
$CoachingRequestDate,
$CoachingCounselDate,
$CoachingDecisionDate,
Function updateStudentMedicalRecord
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function updateStudentMedicalRecord(TblPerson $tblPerson, $Meta)
{
// Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
$tblStudent = $tblPerson->getStudent(true);
- 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
Avoid deeply nested control flow statements. Open
if (($tblLevel = $tblDivision->getTblLevel())
&& !$tblLevel->getIsChecked()
) {
return $tblDivision;
}
Method addStudentSubject
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
TblStudent $tblStudent,
TblStudentSubjectType $tblStudentSubjectType,
TblStudentSubjectRanking $tblStudentSubjectRanking,
TblSubject $tblSubject,
TblLevel $tblLevelFrom = null,
Avoid deeply nested control flow statements. Open
if (isset( $Meta['SubjectLevelTill'] ) && isset( $Meta['SubjectLevelTill'][$Category][$Ranking] )) {
if ($Meta['SubjectLevelTill'][$Category][$Ranking]) {
$tblLevelTill = Division::useService()->getLevelById($Meta['SubjectLevelTill'][$Category][$Ranking]);
}
}
Avoid deeply nested control flow statements. Open
if (isset( $Meta['SubjectLevelFrom'] ) && isset( $Meta['SubjectLevelFrom'][$Category][$Ranking] )) {
if ($Meta['SubjectLevelFrom'][$Category][$Ranking]) {
$tblLevelFrom = Division::useService()->getLevelById($Meta['SubjectLevelFrom'][$Category][$Ranking]);
}
}
Avoid deeply nested control flow statements. Open
if ($divisionYear && $divisionYear->getId() == $tblYear->getId()) {
$tblDivisionList[] = $tblDivisionStudent->getTblDivision();
}
Avoid deeply nested control flow statements. Open
if ($divisionYear && $divisionYear->getId() == $tblYear->getId()) {
if(($tblDivision = $tblDivisionStudent->getTblDivision())){
if (($tblLevel = $tblDivision->getTblLevel())
&& !$tblLevel->getIsChecked()
) {
Method insertStudentMedicalRecord
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$Disease,
$Medication,
$Insurance,
$InsuranceState = 0,
$AttendingDoctor = ''
Function getStudentMaxIdentifier
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getStudentMaxIdentifier()
{
$tblStudentList = (new Data($this->getBinding()))->getStudentAll();
$result = 0;
- 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 getCurrentDivisionByPerson
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getCurrentDivisionByPerson(TblPerson $tblPerson)
{
$tblDivisionList = $this->getCurrentDivisionListByPerson($tblPerson);
if ($tblDivisionList) {
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($tblStudentTransferByTypeArrive) {
(new Data($this->getBinding()))->updateStudentTransfer(
$tblStudentTransferByTypeArrive,
$tblStudent,
$TransferTypeArrive,
- 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 223.
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 ($tblStudentTransferByTypeLeave) {
(new Data($this->getBinding()))->updateStudentTransfer(
$tblStudentTransferByTypeLeave,
$tblStudent,
$TransferTypeLeave,
- 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 223.
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
public function addStudentSubject(
TblStudent $tblStudent,
TblStudentSubjectType $tblStudentSubjectType,
TblStudentSubjectRanking $tblStudentSubjectRanking,
TblSubject $tblSubject,
- 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 90.
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