Function fn_atipay_get_token
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function fn_atipay_get_token($params)
{
$r = wsRequestPost(ATIPAY_TOKEN_URL, $params);
$return = array();
if ($r) {
- 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 _fn_return_state_text
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _fn_return_state_text($state)
{
switch ($state) {
case "CanceledByUser":
return "پرداخت توسط شما لغو شده است.";
Function fn_atipay_verify_payment
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function fn_atipay_verify_payment($params, $amount)
{
$r = wsRequestPost(ATIPAY_VERIFY_URL, $params);
$return = array();
if ($r) {
- 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 _fn_return_state_text
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function _fn_return_state_text($state)
{
switch ($state) {
case "CanceledByUser":
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
Consider simplifying this complex logical expression. Open
if (!isset($params['state']) ||
!isset($params['status']) ||
!isset($params['reservationNumber']) ||
!isset($params['referenceNumber']) ||
!isset($params['terminalId']) ||
Avoid too many return
statements within this method. Open
return "شماره ترمینال ارسال شده یافت نشد";
Avoid too many return
statements within this method. Open
return "با این شماره ترمینال فقط تراکنش هاي توکنی قابل پرداخت هستند";
Avoid too many return
statements within this method. Open
return "آدرس سرور پذیرنده نامعتبر است";
Avoid too many return
statements within this method. Open
return "خطای نامشخص در عملیات پرداخت";
Avoid too many return
statements within this method. Open
return "توکن ارسال شده یافت نشد";
Function fn_check_callback_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function fn_check_callback_data($params)
{
$result = array();
if (isset($params['state']) && !empty($params['state'])) {
$state = $params['state'];
- 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"