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 App\View\Components\Services; use App\Models\Service; use Closure; use I..

Decoded Output download

<?php

namespace App\View\Components\Services;

use App\Models\Service;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\View\Component;

class Links extends Component
{
    public Collection $links;

    public function __construct(public Service $service)
    {
        $this->links = collect([]);
        $service->applications()->get()->map(function ($application) {
            $type = $application->serviceType();
            if ($type) {
                $links = generateServiceSpecificFqdns($application);
                $links = $links->map(function ($link) {
                    return getFqdnWithoutPort($link);
                });
                $this->links = $this->links->merge($links);
            } else {
                if ($application->fqdn) {
                    $fqdns = collect(Str::of($application->fqdn)->explode(','));
                    $fqdns->map(function ($fqdn) {
                        $this->links->push(getFqdnWithoutPort($fqdn));
                    });
                }
                if ($application->ports) {
                    $portsCollection = collect(Str::of($application->ports)->explode(','));
                    $portsCollection->map(function ($port) {
                        if (Str::of($port)->contains(':')) {
                            $hostPort = Str::of($port)->before(':');
                        } else {
                            $hostPort = $port;
                        }
                        $this->links->push(base_url(withPort: false).":{$hostPort}");
                    });
                }
            }
        });
    }

    /**
     * Get the view / contents that represent the component.
     */
    public function render(): View|Closure|string
    {
        return view('components.services.links');
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace App\View\Components\Services;

use App\Models\Service;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\View\Component;

class Links extends Component
{
    public Collection $links;

    public function __construct(public Service $service)
    {
        $this->links = collect([]);
        $service->applications()->get()->map(function ($application) {
            $type = $application->serviceType();
            if ($type) {
                $links = generateServiceSpecificFqdns($application);
                $links = $links->map(function ($link) {
                    return getFqdnWithoutPort($link);
                });
                $this->links = $this->links->merge($links);
            } else {
                if ($application->fqdn) {
                    $fqdns = collect(Str::of($application->fqdn)->explode(','));
                    $fqdns->map(function ($fqdn) {
                        $this->links->push(getFqdnWithoutPort($fqdn));
                    });
                }
                if ($application->ports) {
                    $portsCollection = collect(Str::of($application->ports)->explode(','));
                    $portsCollection->map(function ($port) {
                        if (Str::of($port)->contains(':')) {
                            $hostPort = Str::of($port)->before(':');
                        } else {
                            $hostPort = $port;
                        }
                        $this->links->push(base_url(withPort: false).":{$hostPort}");
                    });
                }
            }
        });
    }

    /**
     * Get the view / contents that represent the component.
     */
    public function render(): View|Closure|string
    {
        return view('components.services.links');
    }
}

Function Calls

None

Variables

None

Stats

MD5 95628470c784f4dd55bb8266b76a0b41
Eval Count 0
Decode Time 79 ms