File yf_payment_api.class.php
has 2054 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
if ( ! function_exists('array_replace_recursive')) {
trigger_error('Not exists function "array_replace_recursive ( PHP 5 >= 5.3.0 )"', E_USER_ERROR);
}
yf_payment_api
has 85 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_payment_api
{
public $user_id_default = null;
public $user_id = null;
Method _operation_check
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _operation_check($options = null)
{
$result = [];
$data = [];
// options
Method mail
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mail($options = null)
{
// DEBUG
// ini_set( 'html_errors', 0 );
// var_dump( $options );
Function operation
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function operation($options = null)
{
$_ = &$options;
$is_no_count = &$_['no_count'];
$is_sql = &$_['sql'];
- 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 transfer
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transfer($options = null)
{
$_ = &$options;
$is_transaction = isset( $_['is_transaction'] ) ? $_['is_transaction'] : true;
// check: from, to
Method cancel
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function cancel($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
Function mail
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function mail($options = null)
{
// DEBUG
// ini_set( 'html_errors', 0 );
// var_dump( $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 provider
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function provider($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// get providers
- 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 _operation_check
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function _operation_check($options = null)
{
$result = [];
$data = [];
// 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 operation
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function operation($options = null)
{
$_ = &$options;
$is_no_count = &$_['no_count'];
$is_sql = &$_['sql'];
Method confirmation_code_check
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function confirmation_code_check($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// operation
Method provider
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provider($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// get providers
Function cancel
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function cancel($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
Method _object_update
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _object_update($name, $data, $options = null)
{
if (empty($name)) {
return null;
}
Method account
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function account($options = null)
{
// by account_id
$result = $this->get_account__by_id($options);
if ( ! empty($result)) {
Function mail_copy_find
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function mail_copy_find(&$mails, $options = null)
{
if (empty($this->MAIL_COPY_TO)) {
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
Method confirmation_ok
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function confirmation_ok($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// operation
Method payment
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function payment($options = null)
{
$_ = &$options;
$is_transaction = isset( $_['is_transaction'] ) ? $_['is_transaction'] : true;
$_['type_name'] = __FUNCTION__;
Method _operation_balance_update
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _operation_balance_update($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// operation
Method confirmation
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function confirmation(&$options = null, &$data = null, &$operation_data = null)
{
$status = true;
$result = [
'status' => &$status,
Consider simplifying this complex logical expression. Open
if (@$_['user_mode'] && (
($type['name'] == 'payment' && $_['is_balance_limit_lower'] && ($balance - $amount < $balance_limit_lower))
|| ($type['name'] == 'transfer' && $direction === 'out' && $_['is_balance_limit_lower'] && ($balance - $amount < $balance_limit_lower))
)) {
$result = [
Method account_create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function account_create($options = null)
{
// options
$_ = &$options;
$data = [];
Method deposition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deposition($options = null)
{
$_ = &$options;
$_['type_name'] = __FUNCTION__;
$_['operation_title'] = $_['operation_title'] ?: 'Пополнение счета';
Method money_format
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function money_format($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// currency
Method dump
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dump($options = null)
{
static $is_first = true;
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
Method status
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function status($options = null)
{
// get status
$status = $this->status;
$status_index = $this->status_index;
Function transaction_start
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function transaction_start($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
$tx = &$this->transaction;
- 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 mail_copy
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mail_copy($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
if (empty($_tpl) || empty($_data)) {
Method is_user_mail
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function is_user_mail($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
Function transfer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function transfer($options = null)
{
$_ = &$options;
$is_transaction = isset( $_['is_transaction'] ) ? $_['is_transaction'] : true;
// check: from, to
- 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 type
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function type($options = null)
{
// get type
$type = $this->type;
$type_index = $this->type_index;
Method get_account__by_id
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_account__by_id($options = null)
{
$account = &$this->account;
$account_id = $this->account_id;
// cache
Method _cancel
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _cancel($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
Function status
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function status($options = null)
{
// get status
$status = $this->status;
$status_index = $this->status_index;
- 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 provider_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function provider_options(&$provider, $options = null)
{
if ( ! isset($options) || ! is_array($provider)) {
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 config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function config($options = null)
{
! empty($options) && $this->CONFIG = $options;
$config = &$this->CONFIG;
if (is_array($config)) {
- 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 _number_api
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _number_api($float = 0, $decimals = null, $decimal_point = null, $thousands_separator = '', $decimal_point_force = null)
Method _number_float
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _number_float($float = 0, $decimals = null, $decimal_point = null, $thousands_separator = '', $decimal_point_force = null)
Method _number_mysql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _number_mysql($float = 0, $decimals = null, $decimal_point = null, $thousands_separator = '', $decimal_point_force = null)
Method _number_format
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _number_format($float = 0, $decimals = null, $decimal_point = null, $thousands_separator = null, $decimal_point_force = null)
Function account
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function account($options = null)
{
// by account_id
$result = $this->get_account__by_id($options);
if ( ! empty($result)) {
- 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 mail_copy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function mail_copy($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
if (empty($_tpl) || empty($_data)) {
- 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 confirmation_code_check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function confirmation_code_check($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// 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 type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function type($options = null)
{
// get type
$type = $this->type;
$type_index = $this->type_index;
- 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 _operation_fetch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _operation_fetch($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
if (is_array($_data)) {
- 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 $result;
Avoid too many return
statements within this method. Open
return $result;
Avoid too many return
statements within this method. Open
return [true, $result, $data];
Avoid too many return
statements within this method. Open
return [$result, $count];
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 [$account_id, $account];
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 $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 $result;
Avoid too many return
statements within this method. Open
return $object;
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;
Function transaction_isolation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function transaction_isolation($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 _cancel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _cancel($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 confirmation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function confirmation(&$options = null, &$data = null, &$operation_data = null)
{
$status = true;
$result = [
'status' => &$status,
- 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 _operation_balance_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _operation_balance_update($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// 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 transaction_finish
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function transaction_finish($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
$tx = &$this->transaction;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function get_type($options = null)
{
$_ = &$options;
$object = $this->type($options);
if (empty($object)) {
- 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 169.
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_status($options = null)
{
$_ = &$options;
$payment_status = $this->status($options);
if (empty($payment_status)) {
- 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 169.
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