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 namespace Tests\Traits; use App\Console\Kernel; use App\Models\User; use Illuminat..

Decoded Output download

<?php

namespace Tests\Traits;

use App\Console\Kernel;
use App\Models\User;
use Illuminate\Contracts\Console\Kernel as Artisan;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\DB;

trait CreatesApplication
{
    protected string $mediaPath = __DIR__ . '/../songs';
    private Kernel $artisan;
    protected string $baseUrl = 'http://localhost';
    public static bool $migrated = false;

    public function createApplication(): Application
    {
        $this->mediaPath = realpath($this->mediaPath);

        /** @var Application $app */
        $app = require __DIR__ . '/../../bootstrap/app.php';

        /** @var Kernel $artisan */
        $artisan = $app->make(Artisan::class);

        $this->artisan = $artisan;
        $this->artisan->bootstrap();

        // Unless the DB is stored in memory, we need to migrate the DB only once for the whole test suite.
        if (!CreatesApplication::$migrated || DB::connection()->getDatabaseName() === ':memory:') {
            $this->artisan->call('migrate');

            if (!User::query()->count()) {
                $this->artisan->call('db:seed');
            }

            CreatesApplication::$migrated = true;
        }

        return $app;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Tests\Traits;

use App\Console\Kernel;
use App\Models\User;
use Illuminate\Contracts\Console\Kernel as Artisan;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\DB;

trait CreatesApplication
{
    protected string $mediaPath = __DIR__ . '/../songs';
    private Kernel $artisan;
    protected string $baseUrl = 'http://localhost';
    public static bool $migrated = false;

    public function createApplication(): Application
    {
        $this->mediaPath = realpath($this->mediaPath);

        /** @var Application $app */
        $app = require __DIR__ . '/../../bootstrap/app.php';

        /** @var Kernel $artisan */
        $artisan = $app->make(Artisan::class);

        $this->artisan = $artisan;
        $this->artisan->bootstrap();

        // Unless the DB is stored in memory, we need to migrate the DB only once for the whole test suite.
        if (!CreatesApplication::$migrated || DB::connection()->getDatabaseName() === ':memory:') {
            $this->artisan->call('migrate');

            if (!User::query()->count()) {
                $this->artisan->call('db:seed');
            }

            CreatesApplication::$migrated = true;
        }

        return $app;
    }
}

Function Calls

None

Variables

None

Stats

MD5 85f7d52fa0e68e7d355c4c7c12182bea
Eval Count 0
Decode Time 119 ms