Function createCheckListExcel
has a Cognitive Complexity of 486 (exceeds 5 allowed). Consider refactoring. Open
public function createCheckListExcel(
TblList $tblList,
$YearPersonId = null,
$LevelPersonId = null,
$SchoolOption1Id = 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 filterObjectList
has a Cognitive Complexity of 284 (exceeds 5 allowed). Consider refactoring. Open
public function filterObjectList($objectList, $filterYear, $filterLevel, $filterSchoolOption1, $filterSchoolOption2)
{
$resultList = 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
File Service.php
has 984 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace SPHERE\Application\Reporting\CheckList;
Function updateListObjectElementList
has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring. Open
public function updateListObjectElementList(
IFormInterface $Stage = null,
$Id = null,
$Data = null,
$HasData = 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 createCheckListExcel
has 258 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createCheckListExcel(
TblList $tblList,
$YearPersonId = null,
$LevelPersonId = null,
$SchoolOption1Id = null,
Function getObjectList
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
public function getObjectList($tblListObjectListByList, $objectList)
{
if ($tblListObjectListByList) {
/** @var TblListObjectElementList $tblListObjectList */
foreach ($tblListObjectListByList as $tblListObjectList) {
- 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 40 functions (exceeds 20 allowed). Consider refactoring. Open
class Service extends AbstractService
{
/**
* @param bool $doSimulation
Method filterObjectList
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function filterObjectList($objectList, $filterYear, $filterLevel, $filterSchoolOption1, $filterSchoolOption2)
{
$resultList = array();
Function updateListObjectElement
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function updateListObjectElement(
IFormInterface $Stage = null,
TblList $tblList = null,
TblObjectType $tblObjectType = null,
$ObjectId = 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 updateListObjectElementList
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateListObjectElementList(
IFormInterface $Stage = null,
$Id = null,
$Data = null,
$HasData = null,
Method updateListObjectElement
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateListObjectElement(
IFormInterface $Stage = null,
TblList $tblList = null,
TblObjectType $tblObjectType = null,
$ObjectId = null,
Method getObjectList
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getObjectList($tblListObjectListByList, $objectList)
{
if ($tblListObjectListByList) {
/** @var TblListObjectElementList $tblListObjectList */
foreach ($tblListObjectListByList as $tblListObjectList) {
Method updateListObjectElement
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
IFormInterface $Stage = null,
TblList $tblList = null,
TblObjectType $tblObjectType = null,
$ObjectId = null,
$Data = null,
Method addElementToList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addElementToList(IFormInterface $Stage = null, $Id, $Element)
{
/**
* Skip to Frontend
Method updateListObjectElementList
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
IFormInterface $Stage = null,
$Id = null,
$Data = null,
$HasData = null,
$objectList = null,
Avoid deeply nested control flow statements. Open
if ($tblObjectType->getIdentifier() === 'PERSON') {
$tblPerson = Person::useService()->getPersonById($objectId);
if ($tblPerson) {
$tblObject = $tblPerson;
$name = $tblPerson->getLastFirstName();
Avoid deeply nested control flow statements. Open
if ($tblProspect) {
$tblProspectReservation = $tblProspect->getTblProspectReservation();
if ($tblProspectReservation) {
if ($filterYear) {
$year = trim($tblProspectReservation->getReservationYear());
Avoid deeply nested control flow statements. Open
if ($tblListObjectElementList->getServiceTblObject()) {
if (!isset($Data[$tblListObjectElementList->getTblObjectType()->getId()]
[$tblListObjectElementList->getServiceTblObject()->getId()]
[$tblListObjectElementList->getTblListElementList()->getId()])
) {
Avoid deeply nested control flow statements. Open
if ($tblProspectReservation) {
$filterYear = trim($tblProspectReservation->getReservationYear());
}
Avoid deeply nested control flow statements. Open
if ($tblObject) {
$tblListObjectElementList = $this->getListObjectElementListByListAndObjectTypeAndListElementListAndObject(
$tblList, $tblObjectType, $tblObject
);
if ($tblListObjectElementList) {
Avoid deeply nested control flow statements. Open
if ($tblProspectReservation) {
$filterLevel = trim($tblProspectReservation->getReservationDivision());
}
Function updateListElementList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function updateListElementList(IFormInterface $Stage = null, TblList $tblList, TblListElementList $tblListElementList, $ElementName)
{
/**
* Skip to Frontend
- 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 (!empty($objects)) {
foreach ($objects as $objectId => $value) {
if ($tblObjectType->getIdentifier() === 'PERSON') {
$tblPerson = Person::useService()->getPersonById($objectId);
$prospectGroup = Group::useService()->getGroupByMetaTable('PROSPECT');
Function addElementToList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addElementToList(IFormInterface $Stage = null, $Id, $Element)
{
/**
* Skip to Frontend
- 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
Consider simplifying this complex logical expression. Open
if ($filterYear && $filterLevel && $filterSchoolOption) {
if ($hasYear && $hasLevel && $hasSchoolOption) {
$resultList[$tblObjectType->getId()][$tblPerson->getId()]
= $tblPerson->getLastFirstName();
}
Method filterObjectList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function filterObjectList($objectList, $filterYear, $filterLevel, $filterSchoolOption1, $filterSchoolOption2)
Method createCheckListExcel
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TblList $tblList,
$YearPersonId = null,
$LevelPersonId = null,
$SchoolOption1Id = null,
$SchoolOption2Id = null
Avoid too many return
statements within this method. Open
return $Stage;
Function updateList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function updateList(IFormInterface $Stage = null, $Id, $List)
{
/**
* Skip to Frontend
- 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 getObjectType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getObjectType(IFormInterface $Stage = null, $ListId = null, $ObjectTypeSelect = null)
{
/**
* Skip to Frontend
- 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 sortObjectList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function sortObjectList($objectList)
{
if (!empty( $objectList )) {
foreach ($objectList as $objectTypeId => $objects) {
- 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 ($tblToPhoneList) {
foreach ($tblToPhoneList as $tblToPhone) {
if (( $tblPhone = $tblToPhone->getTblPhone() )) {
if (!isset($Item['PhoneGuardian'][$tblPersonGuardian->getId()])) {
$Item['PhoneGuardian'][$tblPersonGuardian->getId()] =
- 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 176.
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 3 locations. Consider refactoring. Open
if ($tblProspectReservation) {
$level = $tblProspectReservation->getReservationDivision();
$year = $tblProspectReservation->getReservationYear();
$optionA = $tblProspectReservation->getServiceTblTypeOptionA();
$optionB = $tblProspectReservation->getServiceTblTypeOptionB();
- 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 103.
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 ($YearPersonId !== null) {
$yearPerson = Person::useService()->getPersonById($YearPersonId);
if ($yearPerson) {
$hasFilter = true;
$tblProspect = Prospect::useService()->getProspectByPerson($yearPerson);
- 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 98.
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 ($tblListObjectElementListByList) {
foreach ($tblListObjectElementListByList as $tblListObjectElementList) {
if ($tblListObjectElementList->getServiceTblObject()) {
if (!isset($Data[$tblListObjectElementList->getTblObjectType()->getId()]
[$tblListObjectElementList->getServiceTblObject()->getId()]
- 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 98.
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 ($listObjectElementListList) {
foreach ($listObjectElementListList as $tblListObjectElementList) {
if ($tblListObjectElementList->getServiceTblObject()) {
if (!isset($Data[$tblListObjectElementList->getTblObjectType()->getId()]
[$tblListObjectElementList->getServiceTblObject()->getId()]
- 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 98.
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 ($LevelPersonId !== null) {
$levelPerson = Person::useService()->getPersonById($LevelPersonId);
if ($levelPerson) {
$hasFilter = true;
$tblProspect = Prospect::useService()->getProspectByPerson($levelPerson);
- 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 98.
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