Function apply
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function apply($modifier, $booking, $aggregate_data)
{
if ($modifier->active == false) {
Log::debug('Modificatore non attivo, ignoro applicazione');
return 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 apply
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apply($modifier, $booking, $aggregate_data)
{
if ($modifier->active == false) {
Log::debug('Modificatore non attivo, ignoro applicazione');
return null;
Function handlingAttributes
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function handlingAttributes($booking, $modifier, $attribute)
{
/*
Se l'ordine è chiuso (ma non consegnato e archiviato) attingo dai
valori relativi, che includono sia il consegnato che il prenotato ma
- 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 ModifierEngine.php
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Singletons;
use Illuminate\Support\Facades\Log;
Function targetDefinition
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function targetDefinition($modifier, $value)
{
if ($modifier->scale == 'minor') {
foreach($modifier->definitions as $def) {
if ($value < $def->threshold) {
- 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 handlingAttributes
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handlingAttributes($booking, $modifier, $attribute)
{
/*
Se l'ordine è chiuso (ma non consegnato e archiviato) attingo dai
valori relativi, che includono sia il consegnato che il prenotato ma
Function applyDefinition
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function applyDefinition($booking, $modifier, $amount, $definition, $target)
{
list($quantity_attribute, $price_attribute, $weight_attribute) = $this->applicationOffsets($booking);
$reference_quantity = 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
Method applyDefinition
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function applyDefinition($booking, $modifier, $amount, $definition, $target)
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $this->saveValue($modifier, $obj_mod_target, $altered_amount);
Avoid too many return
statements within this method. Open
return null;
Function saveValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function saveValue($modifier, $obj_mod_target, $altered_amount)
{
$modifier_value = $this->retrieveExistingValue($modifier, $obj_mod_target);
/*
- 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"