File yf_locale_editor.class.php
has 752 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Locale, i18n (Internationalization) editor.
*
yf_locale_editor
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_locale_editor
{
/** @var array @conf_skip */
private static $HELP = [
'edit' => [
Method var_edit
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function var_edit()
{
$a = $this->_get_var_info($_GET['id']);
if ( ! $a) {
return _e('Wrong var id');
Function vars
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function vars()
{
$vars = $this->_get_all_vars_from_files();
$vars_db = $this->_get_all_vars_from_db();
foreach ((array) $vars_db as $source => $a) {
- 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 vars
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function vars()
{
$vars = $this->_get_all_vars_from_files();
$vars_db = $this->_get_all_vars_from_db();
foreach ((array) $vars_db as $source => $a) {
Function var_edit
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function var_edit()
{
$a = $this->_get_var_info($_GET['id']);
if ( ! $a) {
return _e('Wrong var id');
- 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 show
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show()
{
$all_vars = $this->_get_all_vars();
$total_vars = count((array) $all_vars);
$tr_vars = [];
Function show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function show()
{
$all_vars = $this->_get_all_vars();
$total_vars = count((array) $all_vars);
$tr_vars = [];
- 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 _preload_data
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _preload_data()
{
if ($this->_preload_complete) {
return true;
}
Method _show_files_for_lang
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_files_for_lang($lang, $lang_files, $var_files)
{
$yf_path_len = strlen(YF_PATH);
$app_path_len = strlen(APP_PATH);
Method _get_vars_from_files
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _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:
Function _get_var_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _get_var_info($id)
{
$id = trim($id);
if ( ! strlen($id)) {
return [];
- 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_vars_from_files
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _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 files
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function files()
{
$self_page_css = 'body.get-object-' . $_GET['object'];
css('
' . $self_page_css . ' li.li-header { list-style: none; display:none; }
Function _get_all_vars_from_files
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function _get_all_vars_from_files()
{
$vars = [];
foreach ((array) $this->_cur_langs as $lang => $lang_name) {
list($lang_vars, $var_files) = $this->_get_vars_from_files($lang);
- 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 sources
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function sources()
{
$vars = $this->_get_all_vars_from_db();
$files = [];
foreach ((array) $vars as $source => $a) {
- 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"