Showing 44 of 74 total issues
Assets
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
class Assets {
public const BASE_CSS_URL = [
'prefix' => false,
'plugin' => 'DataTables',
OptionsOptionAOTraitTest
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class OptionsOptionAOTraitTest extends TestCase {
/**
* Test subject
*
Column
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
final class Column {
public const TYPE_DATE = 'date';
public const TYPE_NUM = 'num';
public const TYPE_NUM_FMT = 'num-fmt';
QueryBaseState
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
final class QueryBaseState {
/**
* @var array
*/
Function processUrlQuery
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function processUrlQuery() {
$urlQuery = Router::getRequest()->getQuery("data-tables.{$this->_configBundle->getDataTables()->getAlias()}");
if (!empty($urlQuery['page'])) {
$this->setCurrentPage($urlQuery['page']);
}
- 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
OptionsOptionPZTraitTest
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class OptionsOptionPZTraitTest extends TestCase {
/**
* Test subject
*
File Assets.php
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright (c) Allan Carvalho 2020.
* Under Mit License
* link: https://github.com/wsssoftware/cakephp-data-renderer
Function execute
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function execute(Arguments $args, ConsoleIo $io): ?int {
$this->_bakeType = $args->getArgument('type');
$this->_configName = Inflector::camelize($args->getArgument('configName'));
$this->_callback = $args->getArgument('callback');
$this->connection = $args->getOption('connection');
- 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
LanguageOptionTraitTest
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class LanguageOptionTraitTest extends TestCase {
/**
* Test subject
*
Function getFilesBody
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function getFilesBody(array $query, string $type): string {
$files = [];
$md5 = $type . '_' . md5(json_encode($query));
$body = Cache::read($md5, '_data_tables_assets_');
if ($body === 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
Method execute
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute(Arguments $args, ConsoleIo $io): ?int {
$this->_bakeType = $args->getArgument('type');
$this->_configName = Inflector::camelize($args->getArgument('configName'));
$this->_callback = $args->getArgument('callback');
$this->connection = $args->getOption('connection');
Function getFormattedColumn
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getFormattedColumn(string $columnName, Column $column, EntityInterface $entity): string {
$exploded = explode('.', $columnName);
if (count($exploded) === 2) {
$value = $this->getPropertyUsingPath($column->getAssociationPath(), $entity, $exploded[1]);
$integersTypes = ['tinyinteger', 'smallinteger', 'integer', 'biginteger', 'decimal', 'float'];
- 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 setSearchCols
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function setSearchCols(array $searchCols) {
Validator::getInstance()->checkKeysValueTypesOrFail($searchCols, ['integer'], ['array', 'NULL'], '$searchCols');
foreach ($searchCols as $searchCol) {
if ($searchCol !== null) {
foreach ($searchCol as $key => $item) {
- 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 testSimpleOptions
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSimpleOptions() {
$autoWidth = $this->MainOption->isAutoWidth();
$this->MainOption->setAutoWidth(!$autoWidth);
$this->assertEquals(!$autoWidth, $this->MainOption->isAutoWidth());
Function getPluginCurrentCommit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getPluginCurrentCommit(): string {
$subPath = 'composer' . DS . 'installed.json';
$filePaths = [
ROOT . DS . 'vendor' . DS,
DATA_TABLES_ROOT . DS . '..' . DS . '..' . DS,
- 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 processUrlQuery
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processUrlQuery() {
$urlQuery = Router::getRequest()->getQuery("data-tables.{$this->_configBundle->getDataTables()->getAlias()}");
if (!empty($urlQuery['page'])) {
$this->setCurrentPage($urlQuery['page']);
}
Function checkKeysValueTypesOrFail
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function checkKeysValueTypesOrFail(?array $array, $allowedKeyTypes = [], $allowedValueTypes = [], ?string $inString = null): void {
if (empty($array)) {
return;
}
$allowedKeyTypesType = getType($allowedKeyTypes);
- 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 init
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init(): void {
$this->records = [
[
'id' => 1,
'user_id' => 1,
Function getConfigBundle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getConfigBundle(string $dataTables, bool $cache = true): ConfigBundle {
$dataTablesFQN = $this->parseClassNameToFQN($dataTables);
$dataTablesName = explode('\\', $dataTables);
$dataTablesName = array_pop($dataTablesName);
$configure = TableConfigure::getInstance();
- 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 getI18nTranslation
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getI18nTranslation() {
$json = [
'oAria' => [
'sSortAscending' => __d('data_tables', '{0} activate to sort column ascending', ':'),
'sSortDescending' => __d('data_tables', '{0} activate to sort column descending', ':'),