Showing 87 of 98 total issues
Consider simplifying this complex logical expression. Open
if (!isset($params['state']) ||
!isset($params['status']) ||
!isset($params['reservationNumber']) ||
!isset($params['referenceNumber']) ||
!isset($params['terminalId']) ||
Method callCurl
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function callCurl($url, $arrayData, $haveAuth = false, $try = 0, $method = 'POST')
Function purchase
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function purchase()
{
$details = $this->invoice->getDetails();
$phone = null;
- 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 callCurl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function callCurl($url, $arrayData, $haveAuth = false, $try = 0, $method = 'POST')
{
$data = $arrayData;
$jsonData = json_encode($data);
$accessToken = '';
- 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 purchase
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function purchase()
{
$data = [
'api_key' => $this->settings->merchantId,
'order_id' => intval(1, time()) . crc32($this->invoice->getUuid()),
- 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 powMod
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function powMod($p, $q, $r)
{
$factors = array();
$div = $q;
$power_of_two = 0;
- 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
case -11: return "درگاه در انتظار تایید و یا غیرفعال است.";
Avoid too many return
statements within this method. Open
case 1: return "پرداخت با موفقیت انجام شد.";
Avoid too many return
statements within this method. Open
return "شماره ترمینال ارسال شده یافت نشد";
Avoid too many return
statements within this method. Open
case -6: return "کد پین وارد شده اشتباه است.";
Avoid too many return
statements within this method. Open
case -10: return "مبلغ با مبلغ تراکنش مطابقت ندارد.";
Avoid too many return
statements within this method. Open
case -9: return "کد پین درگاه با درگاه تراکنش مطابقت ندارد.";
Avoid too many return
statements within this method. Open
case -7: return "کد تراکنش نمیتواند خالی باشد.";
Avoid too many return
statements within this method. Open
case -13: return "شماره کارت باید 16 رقم چسبیده بهم باشد.";
Avoid too many return
statements within this method. Open
return "با این شماره ترمینال فقط تراکنش هاي توکنی قابل پرداخت هستند";
Avoid too many return
statements within this method. Open
case 2: return "تراکنش قبلا وریفای شده است.";
Avoid too many return
statements within this method. Open
case -5: return "مبلع باید بین 100 تومان تا 50 میلیون تومان باشد.";
Avoid too many return
statements within this method. Open
case -12: return "امکان ارسال درخواست برای این پذیرنده وجود ندارد.";
Avoid too many return
statements within this method. Open
return "آدرس سرور پذیرنده نامعتبر است";
Avoid too many return
statements within this method. Open
return "خطای نامشخص در عملیات پرداخت";