Showing 35 of 293 total issues
Function enabledFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function enabledFields(): array
{
$fields = parent::enabledFields();
if (is_string($this->createdByAttribute) && !empty($this->createdByAttribute)) {
$fields[] = $this->createdByAttribute;
- 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 deleteChildren
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function deleteChildren()
{
$children = $this->children;
if (empty($children)) {
return 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
Function onDeleteChildren
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function onDeleteChildren($event): bool
{
$sender = $event->sender;
/* @var $sender static */
if (empty($sender->parentAttribute) || !is_string($sender->parentAttribute)) {
- 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 insertRelation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function insertRelation($relation, ?Connection $connection = null): bool
{
if (!($relation instanceof static)) {
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
Function setIPAddress
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setIPAddress(?string $ipAddress): int|string|null
{
if (!$ipAddress || !$this->enableIP) {
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
Function unregister
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function unregister(): bool
{
if ($this->getIsNewRecord()) {
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 false;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $this->getIPv6Address();
Function removeRelation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function removeRelation($relation, Connection $connection = null)
{
if (!($relation instanceof static) || $relation->getIsNewRecord()) {
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
Function bear
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function bear(array $config = []): false|static|null
{
if (!$this->parentAttribute) {
throw new InvalidConfigException("Parent Attribute Not Determined.");
}
- 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 getBlameableAttributeRules
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getBlameableAttributeRules()
{
$rules = [];
// 创建者和上次修改者由 BlameableBehavior 负责,因此标记为安全。
if (!is_string($this->createdByAttribute) || empty($this->createdByAttribute)) {
- 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 onReadAtChanged
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function onReadAtChanged($event): void
{
$sender = $event->sender;
/* @var $sender static */
$raAttribute = $sender->readAtAttribute;
- 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 setUpdater
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setUpdater(mixed $updater): bool|string
{
if (!is_string($this->updatedByAttribute) || empty($this->updatedByAttribute)) {
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
Function removeIfExpired
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function removeIfExpired(): bool
{
if ($this->getIsExpired() && !$this->getIsNewRecord()) {
if (($this->expiredRemovingCallback instanceof Closure || is_array($this->expiredRemovingCallback)) && is_callable($this->expiredRemovingCallback)) {
call_user_func($this->expiredRemovingCallback, $this);
- 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"