Showing 71 of 530 total issues
Method getTableNames
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getTableNames()
{
if ($this->tableNames !== null) {
return $this->tableNames;
}
Function saveProducts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function saveProducts($products)
{
foreach ($products as $product) {
if (!$product['name']) {
continue;
- 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 get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function get($key, $default = null, $cache = true, $cachingDuration = false)
{
if ($cache) {
$cacheKey = $this->getCacheKey($key);
$value = ArrayHelper::getValue($this->values, $key, false) ?: \Yii::$app->cache->get($cacheKey);
- 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 generateString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function generateString($string = '', $placeholders = [])
{
$string = addslashes($string);
if ($this->enableI18N) {
// If there are placeholders, use them
- 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 activeTextinput
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function activeTextinput($form, $model, $attribute, $inputOptions = [], $fieldOptions = [])
Function getSchemaNames
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function getSchemaNames()
{
$db = $this->getDbConnection();
$schema = $db->getSchema();
if ($schema->hasMethod('getSchemaNames')) { // keep BC to Yii versions < 2.0.4
- 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 rules
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function rules()
{
$rules = [];
foreach ($this->keys as $attribute => $data) {
$attributeRules = ArrayHelper::getValue($data, 'rules', []);
- 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 beforeAction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function beforeAction($action)
{
$modelPk = \Yii::$app->request->getQueryParam($this->modelPkParam);
if ($modelPk) {
$model = call_user_func($this->modelClass.'::findOne', $modelPk);
- 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 saveToPhpOutput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function saveToPhpOutput($messages, $config)
{
foreach ($messages as $language => $categories) {
$dirName = FileHelper::normalizePath(\Yii::getAlias($config['messagePath'].'/'.$language));
FileHelper::createDśirectory($dirName);
- 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 bootstrap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function bootstrap($app)
{
if ($this->enabled instanceof \Closure) {
$enabled = call_user_func($this->enabled, $app);
} else {
- 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 addInverseRelations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function addInverseRelations($relations)
{
$relationNames = [];
foreach ($this->getSchemaNames() as $schemaName) {
foreach ($this->getDbConnection()->getSchema()->getTableSchemas($schemaName) as $table) {
- 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"