Showing 91 of 108 total issues
Function notVerified
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private function notVerified($status, $method)
{
$message = "";
if ($method == 'token') {
switch ($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
Method purchase
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$terminalId = $this->settings->terminalId;
$orderId = crc32($this->invoice->getUuid());
$amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
Method notVerified
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function notVerified($status, $method)
{
$message = "";
if ($method == 'token') {
switch ($status) {
Method notVerified
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function notVerified($status)
{
$translations = [
5 => 'از انجام تراکنش صرف نظر شد',
17 => 'از انجام تراکنش صرف نظر شد',
Method translateStatusCode
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function translateStatusCode($code): string
{
$translations = [
0 => 'پرداخت تکمیل و با موفقیت انجام شده است',
-1 => 'منتظر ارسال تراکنش و ادامه پرداخت',
Function verify
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function verify() : ReceiptInterface
{
$successFlag = Request::input('success');
$status = Request::input('status');
$orderId = Request::input('orderId');
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
public function purchase()
{
$terminalId = $this->settings->terminalId;
$orderId = crc32($this->invoice->getUuid());
$amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
- 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 purchase
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$details = $this->invoice->getDetails();
$phone = null;
Method translateStatus
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function translateStatus($status)
{
$translations = [
'0' => 'تراکنش با موفقیت انجام شد',
'3' => 'پذيرنده کارت فعال نیست لطفا با بخش امور پذيرندگان، تماس حاصل فرمائید',
Method translateStatus
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function translateStatus($status)
{
$translations = [
'0' => 'تراکنش با موفقیت انجام شد',
'11' => 'شماره کارت نامعتبر است',
Method verify
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify() : ReceiptInterface
{
$successFlag = Request::input('success');
$status = Request::input('status');
$orderId = Request::input('orderId');
Method translateStatus
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function translateStatus($status): string
{
$translations = [
'erSucceed' => 'سرویس با موفقیت اجراء شد.',
'erAAS_UseridOrPassIsRequired' => 'کد کاربری و رمز الزامی هست.',
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 purchaseFailed
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function purchaseFailed($status)
{
$translations = [
400 => "bad request",
401 => "unauthorized. probably wrong or unsent header(s)",
Method purchase
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase(): string
{
$phone = $this->invoice->getDetail('phone')
?? $this->invoice->getDetail('cellphone')
?? $this->invoice->getDetail('mobile');
Method purchase
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$this->auth();
$details = $this->invoice->getDetails();
Method verify
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verify(): ReceiptInterface
{
$resCode = Request::input('ResCode');
if ($resCode != '0') {
throw new InvalidPaymentException($this->translateStatus($resCode), $resCode);
Method purchase
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
if (!empty($this->invoice->getDetails()['description'])) {
$description = $this->invoice->getDetails()['description'];
} else {
Method purchase
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$data = [
'api_key' => $this->settings->merchantId,
'order_id' => intval(1, time()) . crc32($this->invoice->getUuid()),
Method purchase
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function purchase()
{
$metadata = [];
if (!empty($this->invoice->getDetails()['description'])) {