File Order.php
has 651 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
Order
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
class Order extends Model
{
use HasFactory, TracksUpdater, AttachableTrait, ExportableTrait, ModifiableTrait, PayableTrait, CreditableTrait, GASModel, SluggableID, ReducibleTrait;
public $incrementing = false;
Method displayColumns
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function displayColumns()
{
$ret = [
'selection' => (object) [
'label' => _i('Selezione'),
Method calculateInvoicingSummary
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function calculateInvoicingSummary()
{
$summary = (object) [
'order' => $this->id,
'total' => 0,
Function unalignedModifiers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function unalignedModifiers($master_summary)
{
if ($this->isActive()) {
return [];
}
- 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 applyModifiers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function applyModifiers($aggregate_data = null, $enforce_status = false)
{
$modifiers = new Collection();
$order_modifiers = $this->involvedModifiers(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 userBooking
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function userBooking($userid = null)
{
$userobj = null;
if (is_null($userid)) {
Method pendingPackages
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pendingPackages()
{
return $this->innerCache('pending_packages', function($obj) {
$ret = new Collection();
$products = $obj->products()->where('package_size', '!=', 0)->with('measure')->get();
Function topLevelBookings
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function topLevelBookings($status = null)
{
$ret = [];
if (is_null($status)) {
- 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 detachProduct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function detachProduct($product)
{
$altered_bookings = 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 userBooking
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function userBooking($userid = null)
{
$userobj = null;
if (is_null($userid)) {
- 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 getProductConceptsAttribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getProductConceptsAttribute()
{
$ret = new Collection();
foreach ($this->products as $product) {
- 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 calculateInvoicingSummary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function calculateInvoicingSummary()
{
$summary = (object) [
'order' => $this->id,
'total' => 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"