pos/is4c-nf/plugins/BitCoin/gui/BitCoinPaymentPage.php
Method initPayment
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function initPayment($amount)
{
$url = '/api/v1/payment/btc';
if (CoreLocal::get('training')) {
$domain = 'https://private-anon-772bbea0d-bitcoinpaycom.apiary-mock.com';
Method head_content
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function head_content()
{
if (CoreLocal::get('training')) {
$domain = 'https://private-anon-772bbea0d-bitcoinpaycom.apiary-mock.com';
} else {
Function initPayment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private function initPayment($amount)
{
$url = '/api/v1/payment/btc';
if (CoreLocal::get('training')) {
$domain = 'https://private-anon-772bbea0d-bitcoinpaycom.apiary-mock.com';
- 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 preprocess
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function preprocess()
{
// initialize the payment on bitcoinpay.com
// when page first loads
if (isset($_REQUEST['amount'])) {
- 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
Open
return true;