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

Signing you up...

Thank you for signing up!

PHP Decode

class PackageInstaller { public $package; public $slug; public $namespace;..

Decoded Output download

<?  class PackageInstaller 
{ 
    public $package; 
    public $slug; 
    public $namespace; 
    public $path; 
    public $migrations; 
    public function __construct(Request $request, array $installable) 
    { 
        $this->package = array_merge($installable, $request->all()); 
        $this->slug = $installable["slug"]; 
        $this->namespace = "\Incevio\Package\" . Str::studly(Str::replace("-", "_", $this->slug)); 
        $this->path = $installable["path"]; 
        $this->migrations = str_replace(base_path(), '', $this->path . "/database/migrations"); 
    } 
    public function install() 
    { 
        Log::info("Installing package " . $this->slug); 
        try { 
            $package_data = array_merge($this->package, preparePackageInstallation($this->package)); 
            Package::create($package_data); 
            $this->migrate()->seed(); 
        } catch (\Exception $exception) { 
            Log::info("Package installation failed " . $this->slug); 
            Log::error(get_exception_message($exception)); 
            throw new \Exception("Package Installation Failed " . $this->slug); 
        } 
        Log::info("Successfully installed package " . $this->slug); 
        return true; 
    } 
    public function migrate() 
    { 
        Log::info("Migration started for " . $this->slug); 
        Artisan::call("migrate", ["--path" => $this->migrations, "--force" => true]); 
        Log::info(Artisan::output()); 
        return $this; 
    } 
    private function seed() 
    { 
        Log::info("Seeding package data for " . $this->slug); 
        foreach (glob($this->path . "/database/seeds/*.php") as $filename) { 
            $classes = get_declared_classes(); 
            include $filename; 
            $temp = array_diff(get_declared_classes(), $classes); 
            $migration = Arr::last($temp, function ($value, $key) { 
                return $value !== "Illuminate\Database\Seeder"; 
            }); 
            Artisan::call("db:seed", ["--class" => $migration, "--force" => true]); 
            Log::info(Artisan::output()); 
            EFT2k: 
        } 
        Yq6sl: 
        return $this; 
    } 
    public function uninstall() 
    { 
        Log::info("Uninstalling Package: " . $this->slug); 
        $file = $this->path . "/src/Uninstaller.php"; 
        if (!file_exists($file)) { 
            goto J_SXR; 
        } 
        include $file; 
        J_SXR: 
        $class = $this->namespace . "\Uninstaller"; 
        if (class_exists($class)) { 
            goto KhAk_; 
        } 
        Log::info("Uninstaller not found in the package dir for " . $this->slug); 
        throw new \Exception("Uninstaller not found for the package " . $this->slug); 
        KhAk_: 
        try { 
            (new $class())->cleanDatabase(); 
            $this->rollback(); 
        } catch (\Exception $e) { 
            Log::info("Package uninstallation failed: " . $this->slug); 
            throw new \Exception("Uninstallation failed: " . $this->slug); 
        } 
        Log::info("Successfully uninstalled package " . $this->slug); 
        return $this; 
    } 
    private function rollback() 
    { 
        Log::info("Roll back called..."); 
        $migrations = array_reverse(glob($this->path . "/database/migrations/*_*.php")); 
        if (!empty($migrations)) { 
            goto OP0w2; 
        } 
        Log::info("No migration to roll back for package " . $this->slug); 
        return $this; 
        OP0w2: 
        foreach ($migrations as $filename) { 
            $migration = str_replace(".php", '', basename($filename)); 
            Log::info("Rolling back: " . $migration); 
            $row = DB::table("migrations")->where("migration", $migration); 
            if ($row->first()) { 
                goto rHdik; 
            } 
            Log::info($migration . " was not migrated before, probably it\'s a new migration file."); 
            Log::info("Skipping rolled back: " . $migration); 
            goto f8sM9; 
            rHdik: 
            $class = Str::studly(implode("_", array_slice(explode("_", $migration), 4))); 
            if (class_exists($class)) { 
                goto yPNK0; 
            } 
            include $filename; 
            yPNK0: 
            (new $class())->down(); 
            if ($row->delete()) { 
                goto MoxkQ; 
            } 
            Log::info("Rollback FAILED: " . $migration); 
            throw new \Exception("Migration rollback failed: " . $this->slug); 
            goto dLB5a; 
            MoxkQ: 
            Log::info("Rolled back: " . $migration); 
            dLB5a: 
            f8sM9: 
        } 
        EJX5O: 
        Log::info("All migrations has been rolled back for package " . $this->slug); 
        return $this; 
    } 
} ?>

Did this file decode correctly?

Original Code

class PackageInstaller
{
    public $package;
    public $slug;
    public $namespace;
    public $path;
    public $migrations;
    public function __construct(Request $request, array $installable)
    {
        $this->package = array_merge($installable, $request->all());
        $this->slug = $installable["\x73\x6c\165\x67"];
        $this->namespace = "\x5c\x49\156\x63\145\x76\x69\x6f\134\120\x61\143\153\141\147\145\x5c" . Str::studly(Str::replace("\x2d", "\137", $this->slug));
        $this->path = $installable["\x70\141\164\x68"];
        $this->migrations = str_replace(base_path(), '', $this->path . "\57\144\x61\x74\x61\x62\x61\x73\x65\57\x6d\151\147\x72\141\164\x69\157\x6e\163");
    }
    public function install()
    {
        Log::info("\x49\x6e\163\164\141\154\x6c\x69\x6e\147\40\160\x61\x63\x6b\141\147\145\x20" . $this->slug);
        try {
            $package_data = array_merge($this->package, preparePackageInstallation($this->package));
            Package::create($package_data);
            $this->migrate()->seed();
        } catch (\Exception $exception) {
            Log::info("\120\141\x63\153\141\147\x65\40\151\156\163\x74\141\x6c\x6c\x61\x74\x69\x6f\x6e\x20\146\x61\x69\154\145\x64\x20" . $this->slug);
            Log::error(get_exception_message($exception));
            throw new \Exception("\120\x61\x63\x6b\141\147\145\x20\111\x6e\163\x74\141\154\x6c\141\164\151\x6f\156\40\x46\x61\151\154\145\144\40" . $this->slug);
        }
        Log::info("\123\165\143\143\145\x73\x73\x66\x75\154\154\171\x20\151\156\163\164\x61\154\154\x65\x64\40\160\141\143\153\x61\x67\x65\x20" . $this->slug);
        return true;
    }
    public function migrate()
    {
        Log::info("\115\x69\147\162\x61\164\151\x6f\156\x20\x73\x74\x61\x72\x74\145\x64\x20\146\x6f\x72\x20" . $this->slug);
        Artisan::call("\155\x69\147\162\141\164\x65", ["\x2d\55\160\141\x74\150" => $this->migrations, "\x2d\55\x66\x6f\x72\x63\145" => true]);
        Log::info(Artisan::output());
        return $this;
    }
    private function seed()
    {
        Log::info("\x53\x65\145\x64\x69\156\x67\40\x70\x61\x63\153\x61\147\145\40\144\x61\164\x61\x20\146\157\x72\40" . $this->slug);
        foreach (glob($this->path . "\x2f\144\141\x74\x61\x62\x61\x73\x65\x2f\x73\145\x65\x64\x73\57\x2a\x2e\160\x68\160") as $filename) {
            $classes = get_declared_classes();
            include $filename;
            $temp = array_diff(get_declared_classes(), $classes);
            $migration = Arr::last($temp, function ($value, $key) {
                return $value !== "\111\154\154\x75\155\x69\x6e\x61\x74\x65\134\104\141\x74\x61\142\x61\x73\145\134\123\145\145\144\145\162";
            });
            Artisan::call("\144\142\x3a\163\x65\x65\144", ["\x2d\x2d\x63\x6c\x61\x73\x73" => $migration, "\55\55\x66\157\162\143\145" => true]);
            Log::info(Artisan::output());
            EFT2k:
        }
        Yq6sl:
        return $this;
    }
    public function uninstall()
    {
        Log::info("\x55\x6e\x69\x6e\163\164\141\x6c\154\151\156\x67\x20\x50\141\143\x6b\x61\147\145\72\x20" . $this->slug);
        $file = $this->path . "\57\163\x72\143\x2f\125\156\151\156\163\x74\x61\154\154\x65\x72\x2e\160\x68\160";
        if (!file_exists($file)) {
            goto J_SXR;
        }
        include $file;
        J_SXR:
        $class = $this->namespace . "\x5c\125\x6e\x69\156\x73\164\141\154\154\x65\x72";
        if (class_exists($class)) {
            goto KhAk_;
        }
        Log::info("\125\x6e\x69\156\163\164\x61\154\154\145\162\40\156\x6f\164\40\x66\157\x75\x6e\144\x20\151\x6e\40\164\150\x65\x20\x70\x61\x63\153\141\x67\145\40\x64\151\x72\40\x66\x6f\162\40" . $this->slug);
        throw new \Exception("\x55\x6e\151\156\163\164\141\x6c\x6c\x65\162\x20\156\x6f\x74\40\x66\x6f\x75\156\144\x20\146\157\162\x20\164\150\x65\40\160\141\x63\153\141\x67\145\40" . $this->slug);
        KhAk_:
        try {
            (new $class())->cleanDatabase();
            $this->rollback();
        } catch (\Exception $e) {
            Log::info("\x50\141\x63\153\x61\x67\x65\x20\x75\x6e\151\x6e\163\164\x61\x6c\x6c\141\x74\x69\x6f\x6e\40\146\141\151\154\145\144\72\40" . $this->slug);
            throw new \Exception("\125\156\151\156\x73\164\141\x6c\154\x61\164\x69\x6f\x6e\x20\146\x61\x69\154\x65\144\72\40" . $this->slug);
        }
        Log::info("\x53\165\143\143\x65\163\x73\146\165\x6c\154\x79\x20\x75\x6e\x69\x6e\x73\x74\x61\x6c\154\145\x64\x20\x70\x61\143\x6b\141\x67\145\40" . $this->slug);
        return $this;
    }
    private function rollback()
    {
        Log::info("\x52\x6f\154\154\x20\x62\141\143\153\x20\143\141\154\x6c\145\144\56\56\56");
        $migrations = array_reverse(glob($this->path . "\x2f\x64\x61\164\x61\x62\x61\163\145\x2f\x6d\x69\147\x72\141\164\151\x6f\156\x73\x2f\52\137\52\x2e\x70\x68\160"));
        if (!empty($migrations)) {
            goto OP0w2;
        }
        Log::info("\116\157\x20\155\x69\147\x72\141\164\x69\x6f\156\x20\x74\x6f\x20\x72\157\x6c\x6c\40\x62\x61\143\x6b\40\146\157\x72\x20\x70\141\143\x6b\141\x67\x65\x20" . $this->slug);
        return $this;
        OP0w2:
        foreach ($migrations as $filename) {
            $migration = str_replace("\56\160\x68\160", '', basename($filename));
            Log::info("\122\x6f\x6c\154\151\156\147\x20\142\141\x63\x6b\x3a\x20" . $migration);
            $row = DB::table("\x6d\151\x67\x72\141\164\151\157\156\163")->where("\155\151\x67\162\141\164\x69\157\156", $migration);
            if ($row->first()) {
                goto rHdik;
            }
            Log::info($migration . "\40\x77\x61\163\x20\156\x6f\164\40\155\x69\147\162\141\x74\145\144\40\142\x65\x66\x6f\x72\145\x2c\40\160\162\x6f\142\x61\142\x6c\x79\40\x69\164\x5c\x27\163\40\141\x20\x6e\x65\x77\x20\x6d\x69\147\x72\x61\x74\x69\x6f\x6e\40\146\151\x6c\x65\56");
            Log::info("\x53\x6b\x69\160\160\x69\x6e\x67\x20\162\x6f\x6c\154\145\x64\40\x62\x61\x63\x6b\x3a\40" . $migration);
            goto f8sM9;
            rHdik:
            $class = Str::studly(implode("\137", array_slice(explode("\137", $migration), 4)));
            if (class_exists($class)) {
                goto yPNK0;
            }
            include $filename;
            yPNK0:
            (new $class())->down();
            if ($row->delete()) {
                goto MoxkQ;
            }
            Log::info("\x52\157\154\x6c\x62\141\143\153\40\106\x41\x49\114\105\104\72\40" . $migration);
            throw new \Exception("\115\151\x67\162\141\x74\x69\x6f\x6e\x20\x72\157\154\154\142\x61\143\x6b\x20\146\x61\x69\154\x65\144\72\40" . $this->slug);
            goto dLB5a;
            MoxkQ:
            Log::info("\122\x6f\x6c\x6c\x65\144\40\142\141\x63\x6b\72\40" . $migration);
            dLB5a:
            f8sM9:
        }
        EJX5O:
        Log::info("\x41\154\154\40\155\151\x67\x72\x61\x74\151\x6f\156\163\x20\x68\141\x73\x20\x62\x65\x65\156\40\x72\x6f\154\x6c\x65\x64\40\x62\141\x63\x6b\x20\146\157\162\40\160\141\x63\153\141\x67\x65\40" . $this->slug);
        return $this;
    }
}

Function Calls

None

Variables

None

Stats

MD5 2bd71c6e7ea97dfdb11012006459a623
Eval Count 0
Decode Time 48 ms