Showing 35 of 293 total issues
File BlameableTrait.php
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
File UserRelationTrait.php
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
File SelfBlameableTrait.php
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
Function register
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function register(?array $associatedModels = [], array|string|null $authRoles = []): 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
File MultipleBlameableTrait.php
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
Method register
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(?array $associatedModels = [], array|string|null $authRoles = []): bool
{
if (!$this->getIsNewRecord()) {
return false;
}
Function compositeGUIDs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function compositeGUIDs(mixed $models): array|string|null
{
if (empty($models)) {
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 updateChildren
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function updateChildren($value = false)
{
$children = $this->getOldChildren();
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 addSubsidiaryClass
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function addSubsidiaryClass(?string $name, array|string|null $config): bool
{
if (empty($name)) {
throw new InvalidConfigException('Subsidiary name not specified.');
}
- 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 updateChildren
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateChildren($value = false)
{
$children = $this->getOldChildren();
if (empty($children)) {
return true;
Function getIPAddress
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getIPAddress(): ?string
{
if ($this->enableIP <= 0 || $this->enableIP > 3) {
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 addOrCreateBlame
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function addOrCreateBlame(&$blame = null, $user = null)
{
if (!is_string($this->multiBlamesClass)) {
throw new InvalidConfigException
('$multiBlamesClass must be specified if you want to use multiple blameable features.');
- 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 getContentRules
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getContentRules(): array
{
if (!$this->contentAttribute) {
return [];
}
Method getBlameableAttributeRules
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBlameableAttributeRules()
{
$rules = [];
// 创建者和上次修改者由 BlameableBehavior 负责,因此标记为安全。
if (!is_string($this->createdByAttribute) || empty($this->createdByAttribute)) {
Function resetConfirmation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function resetConfirmation(): void
{
$contentAttribute = $this->contentAttribute;
if (empty($contentAttribute)) {
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 getContentRules
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getContentRules(): array
{
if (!$this->contentAttribute) {
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 getIdRules
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getIdRules(): array
{
if (!$this->idAttribute) {
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 gets
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function gets($keys = null)
{
$noInitModel = static::buildNoInitModel();
$query = static::find();
if ($keys == 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 onUpdateChildren
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function onUpdateChildren($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 buildRelation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected static function buildRelation($user, $other)
{
$relationQuery = static::find()->initiators($user)->recipients($other);
$noInit = $relationQuery->noInitModel;
$relation = $relationQuery->one();
- 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"