File RenderCrud.php
has 419 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\admin\ngrest\render;
use luya\admin\components\Auth;
RenderCrud
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class RenderCrud extends Render implements ViewContextInterface, RenderCrudInterface
{
public const TYPE_LIST = 'list';
public const TYPE_CREATE = 'create';
Method getButtons
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getButtons()
{
// if already assigned return the resutl
if ($this->_buttons) {
return $this->_buttons;
Function getButtons
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getButtons()
{
// if already assigned return the resutl
if ($this->_buttons) {
return $this->_buttons;
- 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 renderElementPlugins
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function renderElementPlugins($configContext, $typeConfig, $uniqueId, $attribute, $ngRestModel, $label, $elmni18n)
Function getConfigButtonCondition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getConfigButtonCondition($scope)
{
$buttonConditionConfigOption = $this->config->getOption('buttonCondition');
// return empty string of no condition is defined
- 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 evalGroupFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function evalGroupFields($pointerElements)
{
$groups = [];
if (!$pointerElements) {
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 renderElementPlugins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function renderElementPlugins($configContext, $typeConfig, $uniqueId, $attribute, $ngRestModel, $label, $elmni18n)
{
$args = $typeConfig['args'];
$args['renderContext'] = $this;
$obj = NgRest::createPluginObject($typeConfig['class'], $attribute, $label, $elmni18n, $args);
- 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 getFields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getFields($type)
{
if (!array_key_exists($type, $this->_fields)) {
$fields = [];
if ($this->config->hasPointer($type)) {
- 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 apiQueryString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function apiQueryString($type)
{
// basic query
$query = ['ngrestCallType' => $type];
- 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"