Showing 4,217 of 4,217 total issues
Method _user_message
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _user_message($options = null)
{
$url = &$this->url;
// import operation
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
Method authorize
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function authorize()
{
$url = &$this->url;
$url_authorize = $this->_url('authorize');
// class
Method _user_message
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _user_message($options = null)
{
$url = &$this->url;
// import operation
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
Method _paths
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _paths() {
$paths = [
'.',
'plugins',
];
Method _init
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _init()
{
// Needed to ensure backtracking still works on big templates (extended from 1 000 000 on 26kb stpl js() parsing)
ini_set('pcre.backtrack_limit', '10000000');
Method _prepare_cond_text
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _prepare_cond_text($cond = '', $replace = [], $stpl_name = '', $for_right = false)
{
$prepared_array = [];
$cond = str_replace("\t", '', trim($cond));
foreach (explode(' ', $cond) as $val) {
Method _user_security_checks
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _user_security_checks($user_id)
{
$user_id = (int) $user_id;
if ( ! $this->USER_SECURITY_CHECKS || ! $user_id) {
return false;
Method _rss_general
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _rss_general()
{
foreach ((array) module('comments')->COMMENT_LINKS as $key => $value) {
$where .= 'object_name="' . $key . '"';
if ($value !== end(module('comments')->COMMENT_LINKS)) {
Method send
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send(array $params = [], &$error_message = '')
{
$CRLF = "\r\n";
$TAB = "\t";
Method get_access_token
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_access_token()
{
$access_token = $this->_storage_get('access_token');
if ($access_token) {
return $access_token;
Method _currency_convert
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _currency_convert($number = 0, $c_from = '', $c_to = '')
{
if ( ! $number || ! $c_from || ! $c_to) {
return $number;
}
Method _is_spider
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _is_spider($ip = '', $ua = '')
{
$CHECK_IP = false;
$CHECK_UA = false;
if ($ip && preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip)) {
Method coupon_edit
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function coupon_edit()
{
$_GET['id'] = (int) ($_GET['id']);
if (empty($_GET['id'])) {
return _e('Empty ID!');
Method express
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function express()
{
$date = date('Y-m-d');
$orders_info = db()->query_fetch_all('SELECT * FROM ' . db('shop_orders') . " WHERE delivery_time LIKE '" . $date . "%' AND status = 1");
if ( ! empty($orders_info)) {
Method _do_check_data_is_valid
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _do_check_data_is_valid($rules = [], &$data)
{
$validate_ok = true;
$_all = '__all__';
if (isset($rules[$_all])) {
Method test_validate_multi_select
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_validate_multi_select()
{
$_SERVER['REQUEST_METHOD'] = 'POST';
$params = ['do_not_remove_errors' => 1];
Method test_sql_to_php_db_installer
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_sql_to_php_db_installer()
{
if ($this->_need_skip_test(__FUNCTION__)) {
return;
}
File yf_captcha.class.php
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Class to handle CAPTCHA images (to prevent auto-registering, flooding etc).
*
Similar blocks of code found in 4 locations. Consider refactoring. Open
$expected = implode(PHP_EOL, [
'<script src="' . $url3 . '" type="text/javascript"></script>', // required js
'<script src="' . $jquery_url . '" type="text/javascript"></script>', // Appears as requirement for inlined script, after required js
'<script src="' . $url4 . '" type="text/javascript"></script>', // required asset appears after js and jquery
'<script src="' . $url1 . '" type="text/javascript"></script>', // main script
- 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 123.
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
Similar blocks of code found in 4 locations. Consider refactoring. Open
$expected = implode(PHP_EOL, [
'<script src="' . $jquery_url . '" type="text/javascript"></script>', // Appears first because of required config entry
'<script src="' . $url1 . '" type="text/javascript"></script>', // main script url
'<script src="' . $url2 . '" type="text/javascript"></script>', // main script url
'<script src="' . $url3 . '" type="text/javascript"></script>', // main asset appears after js and jquery
- 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 123.
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