Showing 16 of 18 total issues
Method createPage
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createPage($title, $layoutViewFile, array $layoutPlaceholders, array $options = [])
{
$id = ArrayHelper::getValue($options, 'id', 1);
$parentNavId = ArrayHelper::getValue($options, 'parentNavId', 0);
$isHome = ArrayHelper::getValue($options, 'isHome', true);
Function createSchemaFromRules
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function createSchemaFromRules()
{
$object = $this->getNewModel();
$fields = [];
- 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 AdminDatabaseTableTrait.php
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\testsuite\traits;
use luya\admin\models\Group;
File NgRestTestCase.php
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\testsuite\cases;
use yii\base\InvalidConfigException;
ServerTestCase
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class ServerTestCase extends BaseTestSuite
{
/**
* @var string
*/
Function compareMessages
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function compareMessages($folder, $masterLang)
{
$folder = Yii::getAlias($folder);
$folders = [];
- 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 mockBasicAdminModels
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function mockBasicAdminModels()
{
$this->createAdminUserGroupTable();
$this->createAdminGroupAuthTable();
$this->createAdminAuthTable();
Method actionIndex
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex()
{
if ($this->mode === null) {
$this->mode = $this->select('Table or Model (ActiveRecord) based Fixture', [
self::MODE_MODEL => 'Model (Active Record)',
Method prepare
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepare()
{
// ensure the given and required application components are available.
$this->updateApplicationConfig();
Method createAdminUserFixture
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createAdminUserFixture(array $fixtureData = [], $defaultSchema = true)
{
return new NgRestModelFixture([
'modelClass' => User::class,
'schema' => $defaultSchema ? [
Method createSchemaFromRules
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSchemaFromRules()
{
$object = $this->getNewModel();
$fields = [];
Method testBasicNgRestMethods
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBasicNgRestMethods()
{
$class = $this->modelClass;
$this->assertNotNull($class::ngRestApiEndpoint());
Method itemToStructure
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function itemToStructure($item, $lang, $parentNavId)
{
$id = ArrayHelper::getValue($item, 'id');
$title = ArrayHelper::getValue($item, 'title');
return [
Function actionIndex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionIndex()
{
if ($this->mode === null) {
$this->mode = $this->select('Table or Model (ActiveRecord) based Fixture', [
self::MODE_MODEL => 'Model (Active Record)',
- 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 generateClassFile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function generateClassFile(TableSchema $schema, $className, array $data, $modelClass = null, $tableName = null, $addData = null)
Method assignGroupAuth
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function assignGroupAuth($groupId, $authId, $canCreate = true, $canUpdate = true, $canDelete = true)