Showing 87 of 98 total issues
Method verify
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify() : ReceiptInterface
{
$PaymentStatus = Request::input('PaymentStatus');
if ($PaymentStatus != 'OK') {
throw new InvalidPaymentException('تراکنش از سوی کاربر لغو شد', $PaymentStatus);
Method oauth
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function oauth()
{
$response = $this
->client
->request(
Method verify
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify(): ReceiptInterface
{
$authority = $this->invoice->getTransactionId() ?? Request::input('Authority');
$data = [
"merchant_id" => $this->settings->merchantId,
Method purchase
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase()
{
$name = $this->extractDetails('name');
$mobile = $this->extractDetails('mobile');
$email = $this->extractDetails('email');
Method purchase
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase()
{
$mobile = $this->extractDetails('mobile');
$description = $this->extractDetails('description');
$nationalCode = $this->extractDetails('national_code');
Method verify
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify() : ReceiptInterface
{
$amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
$refNum = Request::post('ref_num');
$cardNumber = Request::post('card_number');
Method purchase
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase(): string
{
$data = array(
'WSContext' => [
'UserId' => $this->settings->username,
Method notVerified
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function notVerified($status)
{
$translations = array(
"1" => "پرداخت انجام نشده است.",
"2" => "پرداخت ناموفق بوده است.",
Method notVerified
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function notVerified($status)
{
$translations = array(
0 => 'درحال حاضر درگاه بانکی قطع شده و مشکل بزودی برطرف می شود',
-1 => 'API Key ارسال نمی شود',
Method purchase
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase()
{
$amount = $this->invoice->getAmount() * ($this->settings->currency == 'T' ? 10 : 1); // convert to rial
if (!empty($this->invoice->getDetails()['description'])) {
Method purchase
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase()
{
$details = $this->invoice->getDetails();
$order_id = $this->invoice->getUuid();
Method callCurl
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function callCurl($url, $arrayData, $haveAuth = false, $try = 0, $method = 'POST')
{
$data = $arrayData;
$jsonData = json_encode($data);
$accessToken = '';
Method purchase
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase()
{
$metadata = [];
if (!empty($this->invoice->getDetails()['description'])) {
Function purchase
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function purchase()
{
$details = $this->invoice->getDetails();
$name = '';
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase()
{
$orderId = $this->extractDetails('orderId');
$phone = $this->extractDetails('phone');
$description = $this->extractDetails('description') ?: $this->settings->description;
Method verify
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify(): ReceiptInterface
{
$status = (int)Request::input('Status');
if ($status != 2) {
$this->purchaseFailed($status);
Method verify
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify(): ReceiptInterface
{
$authority = $this->invoice->getTransactionId() ?? Request::input('Authority');
$data = [
"merchant_id" => $this->settings->merchantId,
Method verify
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify(): ReceiptInterface
{
$tracking_number = Request::post("tracking_number");
$transid = Request::post("transid");
if ($tracking_number === null || $tracking_number === ""|| $transid === ""|| $transid === null) {
Method verify
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify() : ReceiptInterface
{
$refId = Request::input('refid');
$data = [
'amount' => $this->invoice->getAmount() / ($this->settings->currency == 'T' ? 1 : 10), // convert to toman
Method verify
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function verify(): ReceiptInterface
{
$resCode = Request::input('ResCode');
if ($resCode != '0') {
throw new InvalidPaymentException($this->translateStatus($resCode), $resCode);