Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * Payment Ninja (https://paymentninja.com). * * @link https://github.com/invo..

Decoded Output download

<?php
/**
 * Payment Ninja (https://paymentninja.com).
 *
 * @link https://github.com/invoiceninja/invoiceninja source repository
 *
 * @copyright Copyright (c) 2022. Payment Ninja LLC (https://paymentninja.com)
 *
 * @license https://www.elastic.co/licensing/elastic-license
 */

namespace App\Services\Payment;

use App\Models\Payment;
use App\Services\AbstractService;
use App\Utils\Traits\GeneratesCounter;
use Illuminate\Database\QueryException;

class ApplyNumber extends AbstractService
{
    use GeneratesCounter;

    private bool $completed = true;

    public function __construct(private Payment $payment)
    {
    }

    public function run()
    {
        if ($this->payment->number != '') {
            return $this->payment;
        }

        $this->trySaving();

        return $this->payment;
    }

    private function trySaving()
    {
        $x = 1;

        do {
            try {
                $this->payment->number = $this->getNextPaymentNumber($this->payment->client, $this->payment);
                $this->payment->saveQuietly();

                $this->completed = false;
            } catch (QueryException $e) {
                $x++;

                if ($x > 50) {
                    $this->completed = false;
                }
            }
        } while ($this->completed);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * Payment Ninja (https://paymentninja.com).
 *
 * @link https://github.com/invoiceninja/invoiceninja source repository
 *
 * @copyright Copyright (c) 2022. Payment Ninja LLC (https://paymentninja.com)
 *
 * @license https://www.elastic.co/licensing/elastic-license
 */

namespace App\Services\Payment;

use App\Models\Payment;
use App\Services\AbstractService;
use App\Utils\Traits\GeneratesCounter;
use Illuminate\Database\QueryException;

class ApplyNumber extends AbstractService
{
    use GeneratesCounter;

    private bool $completed = true;

    public function __construct(private Payment $payment)
    {
    }

    public function run()
    {
        if ($this->payment->number != '') {
            return $this->payment;
        }

        $this->trySaving();

        return $this->payment;
    }

    private function trySaving()
    {
        $x = 1;

        do {
            try {
                $this->payment->number = $this->getNextPaymentNumber($this->payment->client, $this->payment);
                $this->payment->saveQuietly();

                $this->completed = false;
            } catch (QueryException $e) {
                $x++;

                if ($x > 50) {
                    $this->completed = false;
                }
            }
        } while ($this->completed);
    }
}

Function Calls

None

Variables

None

Stats

MD5 b3f8e330920216c09eb6ffdfaeb57693
Eval Count 0
Decode Time 108 ms