Showing 31 of 37 total issues
Function moveMultiRoot
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function moveMultiRoot($position = null, $siblings = [], $oldParentId)
{
$class = $this->className;
if ((int)$oldParentId == 0) {
return ['error' => Yii::t('jstw', 'Can not move root node as child!')];
- 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 reorder
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function reorder($oldPosition = null, $position = null, $siblings = [])
{
if (null === $oldPosition || null === $position || true === empty($siblings)) {
return ['error' => Yii::t('jstw', 'Invalid data provided!')];
}
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$newParentId = Yii::$app->request->post('parent');
$oldParentId = Yii::$app->request->post('old_parent');
- 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 actionUrl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function actionUrl(array $route, $dataAttributes = true)
{
$baseUrl = Json::encode(Url::to($route));
$union = strpos($baseUrl, '?') > 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
Avoid too many return
statements within this method. Open
return ['error' => $e->getMessage()];
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $this->reorder($oldPosition, $position, $siblings);
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $this->move($position, $siblings, $oldParentId);
Function run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
if (!is_array($this->treeDataRoute)) {
throw new InvalidConfigException("Attribute treeDataRoute is required to use TreeWidget.");
}
- 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"