Showing 15 of 33 total issues
Function getValue
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
protected function getValue($which = 'new')
{
$whichValue = $which.'_value';
// First find the main model that was updated
- 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 RevisionableTrait.php
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Convenia\Revisionable;
/*
Function postSave
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function postSave()
{
$limitReached = false;
if (isset($this->historyLimit) && $this->revisionHistory()->count() >= $this->historyLimit) {
- 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 postSave
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postSave()
{
$limitReached = false;
if (isset($this->historyLimit) && $this->revisionHistory()->count() >= $this->historyLimit) {
Function preSave
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function preSave()
{
if (self::$suspended === true) {
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
Method getValue
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getValue($which = 'new')
{
$whichValue = $which.'_value';
// First find the main model that was updated
Method preSave
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preSave()
{
if (self::$suspended === true) {
return;
}
Function format
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function format($key, $value, $formats)
{
foreach ($formats as $pkey => $format) {
$parts = explode(':', $format);
if (count($parts) === 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 postCreate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postCreate()
{
// Check if we should store creations in our revision history
// Set this value to true in your model if you want to
if (empty($this->revisionCreationsEnabled)) {
Function changedRevisionableFields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function changedRevisionableFields()
{
$changesToRecord = [];
foreach ($this->dirtyData as $key => $value) {
// check that the field is revisionable, and double check
- 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 postCreate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function postCreate()
{
// Check if we should store creations in our revision history
// Set this value to true in your model if you want to
if (empty($this->revisionCreationsEnabled)) {
- 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 userResponsible
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function userResponsible()
{
if (empty($this->user_id)) {
return false;
}
- 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 too many return
statements within this method. Open
return $userModel::find($this->user_id);
Avoid too many return
statements within this method. Open
return $this->format($this->key, $this->$whichValue);
Avoid too many return
statements within this method. Open
return $this->format($this->key, $mainModel->$mutator($this->$whichValue));