File yf_payment_test.class.php
has 1854 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class yf_payment_test
{
public $api = [
yf_payment_test
has 61 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_payment_test
{
public $api = [
// 'Privat24' => true,
// 'LiqPay' => true,
Method mail
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mail()
{
$mail_tpl = [
'payin_success' => [
'type' => 'payin',
Method _api_Interkassa
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _api_Interkassa($title)
{
$php = '';
$api = _class('payment_api__provider_interkassa');
$methods = [
Method currency_rates_current
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function currency_rates_current()
{
$result = [];
$payment_api = _class('payment_api');
// conversion UNT to UAH
Method _payout_EcommPay
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _payout_EcommPay($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'ecommpay',
Method _api_YandexMoney
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _api_YandexMoney($title)
{
$php = '';
$api = _class('payment_api__provider_yandexmoney');
$methods = [
Method _add_panel
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _add_panel($options)
{
static $count = 1;
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// action
Method _api_WebMoney
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _api_WebMoney($title)
{
$php = '';
$api = _class('payment_api__provider_webmoney');
$methods = [
Method _currency_rate_load
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _currency_rate_load($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
Method _payout_YandexMoney
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _payout_YandexMoney($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'yandexmoney',
Method _payout_PerfectMoney
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _payout_PerfectMoney($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'perfectmoney',
Method _payout_WebMoney
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _payout_WebMoney($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'webmoney',
Method _payout_Interkassa
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _payout_Interkassa($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'interkassa',
Method js_cors
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function js_cors()
{
$api = _class('api');
echo <<<'EOS'
<!DOCTYPE html>
Function mail
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function mail()
{
$mail_tpl = [
'payin_success' => [
'type' => 'payin',
- 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 _api_PerfectMoney
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _api_PerfectMoney($title)
{
$php = '';
$api = _class('payment_api__provider_perfectmoney');
$methods = [
Method _render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _render($result)
{
$asset_class = _class('assets');
$asset_class->clean_all();
$asset_class->ADD_IS_DIRECT_OUT = true;
Method _sign_liqpay
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _sign_liqpay()
{
$form = '';
$api = _class('payment_api__provider_liqpay');
// test signature
Method _currency_rates_load
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _currency_rates_load($options = null)
{
// import options
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// var
Function _api_Interkassa
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function _api_Interkassa($title)
{
$php = '';
$api = _class('payment_api__provider_interkassa');
$methods = [
- 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 transaction
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transaction()
{
$payment_api = _class('payment_api');
// var
$result = [];
Method _payout_Privat24
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _payout_Privat24($title)
{
return (array) 'opss...';
$form = '';
$api = _class('payment_api__provider_privat24');
Method _sign_interkassa
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _sign_interkassa()
{
$form = '';
$api = _class('payment_api__provider_interkassa');
// test signature
Method _sign_PerfectMoney
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _sign_PerfectMoney()
{
$form = '';
$api = _class('payment_api__provider_perfectmoney');
// test signature
Method payin
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function payin()
{
if ( ! empty($_POST)) {
$payment_api = _class('payment_api');
$dump = $payment_api->dump();
Method _sign_privat24
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _sign_privat24()
{
$form = '';
$api = _class('payment_api__provider_privat24');
// test signature
Method _sign_YandexMoney
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _sign_YandexMoney()
{
$form = '';
$api = _class('payment_api__provider_yandexmoney');
/*
Method ip_check
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ip_check()
{
$api = _class('payment_api__provider_remote');
$api->ENABLE = true;
// $api = _class( 'api' );
Method _sign_webmoney
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _sign_webmoney()
{
$form = '';
$api = _class('payment_api__provider_webmoney');
// test signature
Function _add_panel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function _add_panel($options)
{
static $count = 1;
is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
// action
- 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 _api_YandexMoney
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function _api_YandexMoney($title)
{
$php = '';
$api = _class('payment_api__provider_yandexmoney');
$methods = [
- 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 _currency_rate_load
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function _currency_rate_load($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 _api_WebMoney
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function _api_WebMoney($title)
{
$php = '';
$api = _class('payment_api__provider_webmoney');
$methods = [
- 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 _payout_EcommPay
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function _payout_EcommPay($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'ecommpay',
- 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 _api_PerfectMoney
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function _api_PerfectMoney($title)
{
$php = '';
$api = _class('payment_api__provider_perfectmoney');
$methods = [
- 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 _payout_PerfectMoney
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _payout_PerfectMoney($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'perfectmoney',
- 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 _payout_WebMoney
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _payout_WebMoney($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'webmoney',
- 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 _payout_Interkassa
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _payout_Interkassa($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'interkassa',
- 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 _payout_YandexMoney
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _payout_YandexMoney($title)
{
$payment_api = _class('payment_api');
$provider_class = $payment_api->provider_class([
'provider_name' => 'yandexmoney',
- 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
Consider simplifying this complex logical expression. Open
if (is_string($_submit) || is_string($action)) {
$expanded = 'false';
! @$_is_action && $expanded_in = '';
// form
$form = '';
Function payin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function payin()
{
if ( ! empty($_POST)) {
$payment_api = _class('payment_api');
$dump = $payment_api->dump();
- 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 _currency_rates_load
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function _currency_rates_load($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 _chunk
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function _chunk($name, $title)
{
if (is_array($title)) {
$chunks = &$title;
$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
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function currency_rates_load()
{
// error_reporting(-1);
$provider = [
'NBU',
- 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 97.
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 currency_rate_load()
{
// error_reporting(-1);
$provider = [
'NBU',
- 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 97.
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