File Siteconfig_model.php
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* PepisCMS
*
Function makeConfigurationTestsAngGetErrors
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function makeConfigurationTestsAngGetErrors()
{
$cache_path = $this->config->item('cache_path');
$cache_path = ($cache_path === '') ? 'application/cache/' : $cache_path;
if ($cache_path[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 getAvailableTimezones
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAvailableTimezones()
{
$tz = array(
'Europe/Amsterdam',
'Europe/Andorra',
Function saveAllConfigurationVariables
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function saveAllConfigurationVariables($data)
{
$known_config_data = (array)$this->getAllConfigurationVariables();
$data = array_merge($known_config_data, $data);
- 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 makeConfigurationTestsAngGetErrors
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makeConfigurationTestsAngGetErrors()
{
$cache_path = $this->config->item('cache_path');
$cache_path = ($cache_path === '') ? 'application/cache/' : $cache_path;
if ($cache_path[0] !== '/') {
Method saveConfigByName
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveConfigByName($name, $value, $module = null)
{
$entry = $this->getByName($name);
$id = false;
Method saveAllConfigurationVariables
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveAllConfigurationVariables($data)
{
$known_config_data = (array)$this->getAllConfigurationVariables();
$data = array_merge($known_config_data, $data);
Function saveConfigByName
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function saveConfigByName($name, $value, $module = null)
{
$entry = $this->getByName($name);
$id = 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
Avoid too many return
statements within this method. Open
return $obj->value;
Function getAvailableThemes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getAvailableThemes()
{
$theme_path = $this->config->item('theme_path');
$dir = opendir($theme_path);
- 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 toValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function toValue($obj)
{
if ($obj->is_serialized) {
return json_decode($obj->value);
} elseif ($obj->is_boolean) {
- 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"