Showing 3,246 of 4,217 total issues
Function data_get_latest_countries
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function data_get_latest_countries()
{
global $url, $result_file, $suffix, $mtpl;
$f2 = __DIR__ . '/' . basename($url) . '.table' . $suffix . '.html';
- 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_db_class
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function load_db_class()
{
static $_loaded_class;
if ($_loaded_class) {
return $_loaded_class;
- 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 add
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function add()
{
$a = (array) $_POST + (array) $a;
$a['back_link'] = url('/@object');
$a['locale'] = $a['locale'] ?: conf('language');
Method get_asset_from_github
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function get_asset_from_github($name, $version = 'master', $asset_data = [], $asset_type)
{
if ( ! $name || ! $asset_data || ! isset($asset_data[$asset_type])) {
return false;
}
Method init_locale
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function init_locale()
{
$langs = $this->LANGUAGES ?: $this->_get_langs();
$lang = strtolower($this->_get_current_lang());
$charset = strtolower($this->_get_current_charset());
Method _get_vars_from_files
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
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:
Method _get_combined_version
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _get_combined_version($out_type = '')
{
if ( ! is_string($this->COMBINED_VERSION_TPL) && is_callable($this->COMBINED_VERSION_TPL)) {
$func = $this->COMBINED_VERSION_TPL;
$version = $func($out_type, $this);
Method _parse_sources
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _parse_sources($params = [])
{
$files = [];
if ($params['include_framework']) {
$params['find_php'] && $files['framework']['php'] = $this->_scan_files('framework', 'php', $params);
Method _url_get_contents
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _url_get_contents($url)
{
if ( ! strlen($url)) {
return false;
}
Method payin
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function payin()
{
if ( ! empty($_POST)) {
$payment_api = _class('payment_api');
$dump = $payment_api->dump();
Method _http_csv
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _http_csv($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
if ( ! is_array($_data) || empty($_file_name)) {
Method _operation
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _operation($request, $options)
{
$api = _class('api');
$payment_api = _class('payment_api');
// update account, operation
Method _form
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _form($data, $options = null)
{
if ( ! $this->ENABLE) {
return null;
}
Method recreate_items
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function recreate_items()
{
// options
$operation_id = @$_GET['operation_id'];
$items = explode(',', @$_GET['items']);
Method _form
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _form($data, $options = null)
{
if ( ! $this->ENABLE) {
return null;
}
Method copy_item
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function copy_item()
{
$dir_name = urldecode($_POST['dir_name']);
$items_to_copy = [];
foreach ((array) $_POST as $k => $v) {
Method parse
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function parse($name, $replace = [], $params = [])
{
$string = $params['string'] ?: false;
$this->_fix_replace($replace, $name);
Method _do_logout
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _do_logout($no_redirect = false)
{
if ($this->STORE_ONLINE_USERS) {
db()->_add_shutdown_query('DELETE FROM ' . db('online') . ' WHERE user_id=' . (int) ($_SESSION[$this->VAR_USER_ID]));
$MAIN = &main();
Method _get_info
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _get_info($id = null, $lang = null)
{
$id = isset($id) ? $id : $_GET['id'];
$lang = isset($lang) ? $lang : $_GET['page'];
$a = db()->from(self::table)
Method _init
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function _init()
{
$this->REWRITE_PATTERNS = [
'yf' => _class('rewrite_pattern_yf', 'classes/rewrite/'),
];