Showing 9 of 12 total issues
Method processManyToManyChange
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function processManyToManyChange($relation_method_name, $new_value, $override_relationship_method = null)
{
// The join between the model and the other model
$relation = $this->$relation_method_name();
Function bootLogChangeTrait
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function bootLogChangeTrait()
{
// Saved model event
static::saved(function ($model) {
- 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 getModelChangeDiff
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function getModelChangeDiff($column_name, &$log_change, $old_text, $new_text)
{
if (is_array($old_text) && is_array($new_text)) {
$difference = (new MapDiffer())->doDiff($old_text, $new_text);
- 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 bootLogChangeTrait
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function bootLogChangeTrait()
{
// Saved model event
static::saved(function ($model) {
Method getModelChangeDiff
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getModelChangeDiff($column_name, &$log_change, $old_text, $new_text)
{
if (is_array($old_text) && is_array($new_text)) {
$difference = (new MapDiffer())->doDiff($old_text, $new_text);
Function bootChangeByUserTrait
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function bootChangeByUserTrait()
{
static::creating(function ($model) {
if (!App::runningInConsole() && Auth::check()) {
if ($model->getCreatedByColumn()) {
- 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 addModelChange
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
$model_id,
$table_name,
$column_name,
$old_text,
$new_text,
Function handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
// Read the app folder & save
$models = Storage::disk('models')->allFiles();
- 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 processManyToManyChange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function processManyToManyChange($relation_method_name, $new_value, $override_relationship_method = null)
{
// The join between the model and the other model
$relation = $this->$relation_method_name();
- 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"