File Api.php
has 505 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\admin\ngrest\base;
use luya\admin\base\RestActiveController;
Api
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Api extends RestActiveController
{
/**
* @var string Defines the related model for the NgRest Controller. The full qualiefied model name
* is required.
Method actionExport
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionExport()
{
$extension = null;
$mime = null;
$header = Yii::$app->request->getBodyParam('header', 1);
Method actions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actions()
{
$actions = [
'index' => [ // for casual api request behavior
'class' => 'luya\admin\ngrest\base\actions\IndexAction',
Method actionServices
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionServices()
{
$settings = [];
$apiEndpoint = $this->model->ngRestApiEndpoint();
$userSortSettings = Yii::$app->adminuser->identity->setting->get('ngrestorder.admin/'.$apiEndpoint, false);
Function actionExport
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionExport()
{
$extension = null;
$mime = null;
$header = Yii::$app->request->getBodyParam('header', 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
Function formatExportValues
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function formatExportValues(ActiveQuery $query, array $formatter)
{
Yii::$app->formatter->nullDisplay = '';
$data = [];
$rowId = 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
Method actionRelationCall
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionRelationCall($arrayIndex, $id, $modelClass, $query = null)
{
$modelClass = base64_decode($modelClass);
if (!class_exists($modelClass)) {
Function actionServices
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionServices()
{
$settings = [];
$apiEndpoint = $this->model->ngRestApiEndpoint();
$userSortSettings = Yii::$app->adminuser->identity->setting->get('ngrestorder.admin/'.$apiEndpoint, 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 actionRelationCall
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionRelationCall($arrayIndex, $id, $modelClass, $query = null)
{
$modelClass = base64_decode($modelClass);
if (!class_exists($modelClass)) {
- 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 relationsFromExpand
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function relationsFromExpand(array $relations, array $expandPrefixes)
{
$valid = [];
foreach ($expandPrefixes as $prefix) {
foreach ($relations as $relation) {
- 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 getWithRelation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getWithRelation($actionName)
{
$expand = Yii::$app->request->get('expand', '');
$relationPrefixes = [];
foreach (StringHelper::explode($expand, ',', true, true) as $relation) {
- 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"