File yf_i18n.class.php
has 551 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Locale handler.
*
Function translate_string
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
public function translate_string($in, $args = 0, $lang = '')
{
if ( ! $in) {
return $in;
}
- 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 _process_sub_patterns
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function _process_sub_patterns($text = '', $args = [])
{
if (false === strpos($text, '{') || ! is_array($args)) {
return $text;
}
- 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 translate_string
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function translate_string($in, $args = 0, $lang = '')
{
if ( ! $in) {
return $in;
}
Method _get_current_lang
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_current_lang($force = false)
{
$langs = $this->LANGUAGES ?: $this->_get_langs();
$FORCE_LOCALE = conf('FORCE_LOCALE');
Function _get_current_lang
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function _get_current_lang($force = false)
{
$langs = $this->LANGUAGES ?: $this->_get_langs();
$FORCE_LOCALE = conf('FORCE_LOCALE');
- 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 _load_lang_get_vars_from_files
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function _load_lang_get_vars_from_files($lang)
{
$files = [];
// Auto-find shared language vars. They will be connected in order of file system
// Names can be any, but better to include lang name into file name. Examples:
- 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 _process_sub_patterns
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _process_sub_patterns($text = '', $args = [])
{
if (false === strpos($text, '{') || ! is_array($args)) {
return $text;
}
Method _load_lang_get_vars_from_files
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _load_lang_get_vars_from_files($lang)
{
$files = [];
// Auto-find shared language vars. They will be connected in order of file system
// Names can be any, but better to include lang name into file name. Examples:
Method init_locale
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init_locale()
{
$langs = $this->LANGUAGES ?: $this->_get_langs();
$lang = strtolower($this->_get_current_lang());
$charset = strtolower($this->_get_current_charset());
Function _load_lang
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _load_lang($lang = '')
{
if ( ! $this->TRANSLATE_ENABLED) {
return 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 $lang;
Avoid too many return
statements within this method. Open
return $a['locale'];
Avoid too many return
statements within this method. Open
return $this->CUR_LOCALE;
Avoid too many return
statements within this method. Open
return $lang;
Avoid too many return
statements within this method. Open
return $out;
Avoid too many return
statements within this method. Open
return $lang;