Showing 4,217 of 4,217 total issues
Identical blocks of code found in 4 locations. Consider refactoring. Open
public function _get_methods_names_from_text($text = '', $ONLY_PRIVATE_METHODS = false)
{
$methods = [];
if (empty($text)) {
return $methods;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 130.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File yf_manage_emails.class.php
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class yf_manage_emails
{
const table = 'emails_templates';
Function _operation
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _operation($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
- 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 _parse_sources
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _parse_sources($params = [])
{
$files = [];
if ($params['include_framework']) {
$params['find_php'] && $files['framework']['php'] = $this->_scan_files('framework', 'php', $params);
- 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 _is_current_page
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _is_current_page($item)
{
$object = $_GET['object'];
$action = $_GET['action'];
$id = $_GET['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
Function _compile_prepare_cond
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _compile_prepare_cond($cond = '', $for_right = false)
{
$cond = trim($cond);
$_array_magick = [
'_key' => '$_k',
- 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 display_what
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function display_what()
{
$hooks_data = _class('admin_methods')->call_hooks('settings', $r);
$avail_hook_modules = [];
foreach ((array) $hooks_data as $k => $v) {
- 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 validate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function validate($validate_rules = [], $post = [], $extra = [])
{
$this->_validate_prepare($validate_rules, $extra);
$func = function ($validate_rules, $post, $extra, $form) {
- 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 whereid
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function whereid()
{
$id = func_get_args();
$pk = '';
if (count((array) $id) > 1) {
- 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_data
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function load_data()
{
// Preload db installer SQL CREATE TABLE DDL statements
$ext = '.sql.php';
$pattern = '{,plugins/*/}{,share/}db/sql/*' . $ext;
- 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 list_keys
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function list_keys()
{
$do_real_work = true;
if ( ! $this->_driver_ok) {
$do_real_work = 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
Function http_request
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function http_request($url, $headers = [], $method = 'GET', $data = null, $retry = 3)
{
$result = new stdClass();
// Parse the URL, and make sure we can handle the schema.
$uri = parse_url($url);
- 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 multi_file_size
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function multi_file_size($page_urls, $options = [], $max_threads = 50)
{
if (empty($max_threads)) {
$max_threads = $this->CURL_DEF_MAX_THREADS;
}
- 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 _hook_side_column
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _hook_side_column()
{
$custom_class_name = 'sample_' . $_GET['action'];
$custom_obj = _class_safe($custom_class_name);
$hook_name = __FUNCTION__;
- 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 send
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function send($phone, $text, $params = [])
{
if ( ! $this->_is_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
Function _check
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _check($target_user_id = 0, $source_user_id = 0)
{
if (empty($source_user_id) && ! empty(main()->USER_ID)) {
$source_user_id = main()->USER_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
Function btn_active
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function btn_active($name = '', $link = '', $extra = [])
{
if (is_array($name)) {
$extra = $name;
$name = '';
- 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 _lst
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _lst($id, $with_root = false)
{
$dir = $this->_path($id);
$res = [];
foreach (glob(rtrim($dir, '/') . '/*') as $f) {
- 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 upload_images
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function upload_images()
{
$SUPPLIER_ID = $this->SUPPLIER_ID;
$ADMIN_INFO = db()->query_fetch('SELECT * FROM ' . db('sys_admin') . ' WHERE id=' . (int) (main()->ADMIN_ID));
$SUPPLIER_INFO = db()->query_fetch('SELECT * FROM ' . db('shop_suppliers') . ' WHERE id=' . (int) $SUPPLIER_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
Function _init_sftp_phpseclib
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _init_sftp_phpseclib($server_info = [])
{
if ( ! $this->DRIVER == 'phpseclib') {
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"