Function normalizeData
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function normalizeData() {
if ($this->useLocales == TRUE) {
// deleting non locale fields from data array (except those what are present $this->nonLocaleKeys)
foreach ($this->siteinfo as $key => $value) {
if (!in_array($key, $this->locales) & !in_array($key, $this->nonLocaleKeys)) {
- Read upRead up
- Create a ticketCreate a ticket
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 getSiteInfoData
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function getSiteInfoData($byLocale = FALSE) {
if ($this->useLocales == TRUE & $byLocale !== FALSE) {
if (is_string($byLocale) & in_array($byLocale, $this->locales)) {
$locale = $byLocale;
} else {
- Read upRead up
- Create a ticketCreate a ticket
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 setSiteInfoData
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function setSiteInfoData(array $siteInfo) {
$languages = CI::$APP->db->get('languages')->result_array();
if ($this->useLocales === TRUE) {
- Read upRead up
- Create a ticketCreate a ticket
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 getSiteInfo
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getSiteInfo($name = NULL) {
// simple checks just in case
if (!is_string($name)) {
return '';
}
- Read upRead up
- Create a ticketCreate a ticket
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 setSiteInfoValue
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function setSiteInfoValue($key, $value, $contacts = FALSE) {
if (0 !== strpos($key, 'siteinfo_')) {
$key = 'siteinfo_' . $key;
}
- Read upRead up
- Create a ticketCreate a ticket
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 getSiteInfo
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSiteInfo($name = NULL) {
// simple checks just in case
if (!is_string($name)) {
return '';
}
- Create a ticketCreate a ticket
Function contactsKeys
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function contactsKeys($key, $lang) {
$siteinfoAll = $this->getSiteInfoData(FALSE);
$locale = MY_Controller::getCurrentLocale();
$keysMain = [];
- Read upRead up
- Create a ticketCreate a ticket
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 deleteSiteInfoValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function deleteSiteInfoValue($key, $contacts = FALSE) {
if (0 !== strpos($key, 'siteinfo_')) {
$key = 'siteinfo_' . $key;
}
if ($this->useLocales != TRUE || in_array($key, $this->nonLocaleKeys)) {
- Read upRead up
- Create a ticketCreate a ticket
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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($locale = NULL) {
if ($this->useLocales === TRUE) {
$this->locale = $locale !== null ? $locale : MY_Controller::getCurrentLocale();
}
- Read upRead up
- Create a ticketCreate a ticket
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 $this->siteinfo['contacts'][$nameTemp];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return false;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $siteinfo[$name];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $siteinfo['contacts'][$name];
- Create a ticketCreate a ticket