File yf_manage_payout.class.php
has 2091 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class yf_manage_payout
{
public $IS_PAYOUT_INTERKASSA = null;
Method _operation
has 204 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _operation($options = null)
{
// var
$is_valid = true;
$is_options = true;
Method view
has 173 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function view()
{
// check operation
$operation = $this->_operation();
// import options
Method show
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show()
{
$object = &$this->object;
$action = &$this->action;
$filter_name = &$this->filter_name;
yf_manage_payout
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_manage_payout
{
public $IS_PAYOUT_INTERKASSA = null;
public $payment_api = null;
Method _recreate
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _recreate($options = null)
{
// import operation
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
Method _init
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _init()
{
// class
$this->payment_api = _class('payment_api');
$this->manage_payment_lib = module('manage_payment_lib');
Method csv_ecommpay
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function csv_ecommpay($options = null)
{
$operation_id = &$_POST['operation_id'];
if ( ! is_array($operation_id) || count($operation_id) < 1) {
common()->message_info('Отсутствуют данные');
Function _operation
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function _operation($options = null)
{
// var
$is_valid = true;
$is_options = true;
- 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 csv_ecommpay
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function csv_ecommpay($options = null)
{
$operation_id = &$_POST['operation_id'];
if ( ! is_array($operation_id) || count($operation_id) < 1) {
common()->message_info('Отсутствуют данные');
- 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 view
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function view()
{
// check operation
$operation = $this->_operation();
// import options
- 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 _filter_form_show
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _filter_form_show($filter, $replace)
{
$order_fields = [
'o.operation_id' => 'номер операций',
'o.amount' => 'сумма',
Method stats
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stats()
{
$payment_api = &$this->payment_api;
// payment providers
$providers = $payment_api->provider();
Method _user_message
has 56 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 recreate
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function recreate()
{
// var
$payment_api = &$this->payment_api;
$url = &$this->url;
Method _check_interkassa
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check_interkassa($options = null)
{
// check operation
$operation = $this->_operation($options);
// import options
Function _user_message
has a Cognitive Complexity of 15 (exceeds 5 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, '');
- 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 _status
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _status($options = null)
{
// check operation
$operation = $this->_operation($options);
// import options
Method interkassa_detect_card
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function interkassa_detect_card($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
if (empty($_card)) {
Method request_interkassa
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function request_interkassa()
{
// start
db()->begin();
// check operation
Method status_interkassa
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function status_interkassa($options = null)
{
// import operation
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// provider interkassa
Function _recreate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function _recreate($options = null)
{
// import operation
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
Method check_all_interkassa
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function check_all_interkassa($options = null)
{
// command line interface
$is_cli = (php_sapi_name() == 'cli');
$is_cli && $this->_check_all_interkassa_cli();
Function interkassa_detect_card
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function interkassa_detect_card($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
if (empty($_card)) {
- 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 csv
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function csv()
{
// class
$payment_api = &$this->payment_api;
$provider_class = $payment_api->provider_class([
Method mass_cancel
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mass_cancel($options = null)
{
$operation_id = $this->_get_operation_id($options);
is_numeric($operation_id) && $operation_id = [$operation_id => 1];
if ( ! is_array($operation_id)) {
Method _confirmation_update_expired
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _confirmation_update_expired()
{
// var
$payment_api = _class('payment_api');
// update status only in_progress
Method mass_payout
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mass_payout($options = null)
{
$operation_id = $this->_get_operation_id($options);
is_numeric($operation_id) && $operation_id = [$operation_id => 1];
if ( ! is_array($operation_id)) {
Function _get_daily_data
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function _get_daily_data($days = null)
{
$time = time();
$days = $days ?: 60;
$min_time = $time - $days * 86400;
- 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 _save_csv
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _save_csv($file_name, $data = null)
{
// setlocale( LC_ALL, 'ru_RU.utf8' )
// || setlocale( LC_ALL, 'ru_UA.utf8' )
// || setlocale( LC_ALL, 'en_US.utf8' );
Method _get_daily_data
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_daily_data($days = null)
{
$time = time();
$days = $days ?: 60;
$min_time = $time - $days * 86400;
Method _request
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _request($options = null)
{
// start
db()->begin();
// check operation
Function _save_csv
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function _save_csv($file_name, $data = null)
{
// setlocale( LC_ALL, 'ru_RU.utf8' )
// || setlocale( LC_ALL, 'ru_UA.utf8' )
// || setlocale( LC_ALL, 'en_US.utf8' );
- 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 _http_csv
has 31 lines of code (exceeds 25 allowed). Consider refactoring. 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 recreate_items
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function recreate_items()
{
// options
$operation_id = @$_GET['operation_id'];
$items = explode(',', @$_GET['items']);
Method confirmation_update_expired
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function confirmation_update_expired()
{
$url = &$this->url;
// command line interface
$is_cli = (php_sapi_name() == 'cli');
Method _check_all_interkassa
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check_all_interkassa()
{
// var
$html = _class('html');
$payment_api = &$this->payment_api;
Method _show_filter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_filter()
{
$object = &$this->object;
$action = &$this->action;
$filter_name = &$this->filter_name;
Function show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function show()
{
$object = &$this->object;
$action = &$this->action;
$filter_name = &$this->filter_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 _status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function _status($options = null)
{
// check operation
$operation = $this->_operation($options);
// import options
- 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_interkassa
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function _check_interkassa($options = null)
{
// check operation
$operation = $this->_operation($options);
// import options
- 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 'o.operation_id = ' . (int) $v;
Avoid too many return
statements within this method. Open
return 'o.operation_id IN(' . _es($v) . ')';
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return 'u.id IN(' . _es($v) . ')';
Avoid too many return
statements within this method. Open
return $r;
Avoid too many return
statements within this method. Open
return '(u.name ' . $like . ' OR u.nick ' . $like . ' OR u.login ' . $like . ' OR u.email ' . $like . ')';
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $object;
Avoid too many return
statements within this method. Open
return
'<div class="col-md-12">' .
($data_chart ? '<div class="col-md-6" title="' . t('Транзакции по дням') . '">' . $data_chart . '</div>' : '') .
($quick_filter ? '<div class="col-md-6 pull-right" title="' . t('Быстрый фильтр') . '">' . $quick_filter . '</div>' : '') .
'</div>' .
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $this->_user_message($result);
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $this->_user_message($result);
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $this->_user_message($result);
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return 'u.id = ' . (int) $v;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return '(o.title ' . $like . ' OR o.options ' . $like . ')';
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return $result;
Function _confirmation_update_expired
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _confirmation_update_expired()
{
// var
$payment_api = _class('payment_api');
// update status only in_progress
- 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_csv
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. 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)) {
- 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 request_interkassa
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function request_interkassa()
{
// start
db()->begin();
// check operation
- 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 mass_payout
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function mass_payout($options = null)
{
$operation_id = $this->_get_operation_id($options);
is_numeric($operation_id) && $operation_id = [$operation_id => 1];
if ( ! is_array($operation_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 mass_cancel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function mass_cancel($options = null)
{
$operation_id = $this->_get_operation_id($options);
is_numeric($operation_id) && $operation_id = [$operation_id => 1];
if ( ! is_array($operation_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
Identical blocks of code found in 2 locations. Consider refactoring. Open
return form($replace, [
'filter' => true,
'selected' => $filter,
])
->daterange('datetime_start', [
- 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 471.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
$result = table($sql, [
'filter' => $filter,
'filter_params' => [
'status_id' => function ($a) use ($payment_status_in_progress_id) {
$result = null;
- 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 449.
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 2 locations. Consider refactoring. Open
public function _get_daily_data($days = null)
{
$time = time();
$days = $days ?: 60;
$min_time = $time - $days * 86400;
- 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 317.
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 2 locations. Consider refactoring. Open
public function confirmation_update_expired()
{
$url = &$this->url;
// command line interface
$is_cli = (php_sapi_name() == 'cli');
- 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 300.
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 2 locations. Consider refactoring. Open
$content = table($response, ['no_total' => true])
->text('datetime', 'дата')
->func('data', function ($value, $extra, $row) use ($_provider_name, $_providers_user__by_name) {
// message
$message = @$row['status_message'] ?: @$row['data']['message'];
- 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 265.
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 2 locations. Consider refactoring. Open
public function _show_quick_filter()
{
$a = [];
$status_names = from('payment_status')->get_2d('status_id, title');
$count_by_status = select(['status_id', 'COUNT(*) AS num'])->from('payment_operation')
- 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 249.
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
Identical blocks of code found in 5 locations. Consider refactoring. Open
public function _show_filter()
{
$object = &$this->object;
$action = &$this->action;
$filter_name = &$this->filter_name;
- 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 181.
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 2 locations. Consider refactoring. Open
foreach ($operation_id as $id => $selected) {
$id = (int) $id;
if ($id < 1) {
continue;
}
- 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 154.
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 2 locations. Consider refactoring. Open
foreach ($operation_id as $id => $selected) {
$id = (int) $id;
if ($id < 1) {
continue;
}
- 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 154.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (is_array($o_options['processing'])) {
$processing_log = array_reverse($o_options['processing']);
$processing = reset($processing_log);
if (@$processing['provider_name'] && $processing['provider_name'] != $provider_name) {
@list($processing_provider_id, $processing_provider) = $payment_api->get_provider([
- 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 145.
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 2 locations. Consider refactoring. Open
public function filter_save()
{
$object = &$this->object;
$id = &$this->id;
switch ($id) {
- 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 121.
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
Identical blocks of code found in 5 locations. Consider refactoring. Open
public function _url($name, $replace = null)
{
$url = &$this->url;
$result = null;
if (empty($url[$name])) {
- 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 112.
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 7 locations. Consider refactoring. Open
$content && $html_operations_by_method = table($content, ['no_total' => true])
->text('operation_id', 'операция')
->text('account_number', 'счет, номер карты, кошелек')
->func('amount', function ($value, $extra, $row) use ($payment_api) {
$result = $payment_api->money_html($value);
- 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 110.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
$db = db()->select(
'o.operation_id',
'o.account_id',
'o.provider_id',
'o.options',
- 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 108.
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 2 locations. Consider refactoring. Open
public function expired($options = null)
{
$operation_id = (int) $this->_get_operation_id($options);
if ($operation_id < 1) {
$result = [
- 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 96.
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 2 locations. Consider refactoring. Open
public function cancel($options = null)
{
$operation_id = (int) $this->_get_operation_id($options);
if ($operation_id < 1) {
$result = [
- 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 96.
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