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\Values; use Illuminate\Contracts\Support\Arrayable; use Illuminate\S..

Decoded Output download

<?php

namespace App\Values;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;

final class AlbumInformation implements Arrayable
{
    use FormatsLastFmText;

    private function __construct(public ?string $url, public ?string $cover, public array $wiki, public array $tracks)
    {
    }

    public static function make(
        ?string $url = null,
        ?string $cover = null,
        array $wiki = ['summary' => '', 'full' => ''],
        array $tracks = []
    ): self {
        return new self($url, $cover, $wiki, $tracks);
    }

    public static function fromLastFmData(object $data): self
    {
        return self::make(
            url: $data->url,
            cover: Arr::get($data->image, '0.#text'),
            wiki: [
                'summary' => isset($data->wiki) ? self::formatLastFmText($data->wiki->summary) : '',
                'full' => isset($data->wiki) ? self::formatLastFmText($data->wiki->content) : '',
            ],
            tracks: array_map(static fn ($track): array => [
                'title' => $track->name,
                'length' => (int) $track->duration,
                'url' => $track->url,
            ], $data->tracks?->track ?? []),
        );
    }

    /** @return array<mixed> */
    public function toArray(): array
    {
        return [
            'url' => $this->url,
            'cover' => $this->cover,
            'wiki' => $this->wiki,
            'tracks' => $this->tracks,
        ];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace App\Values;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;

final class AlbumInformation implements Arrayable
{
    use FormatsLastFmText;

    private function __construct(public ?string $url, public ?string $cover, public array $wiki, public array $tracks)
    {
    }

    public static function make(
        ?string $url = null,
        ?string $cover = null,
        array $wiki = ['summary' => '', 'full' => ''],
        array $tracks = []
    ): self {
        return new self($url, $cover, $wiki, $tracks);
    }

    public static function fromLastFmData(object $data): self
    {
        return self::make(
            url: $data->url,
            cover: Arr::get($data->image, '0.#text'),
            wiki: [
                'summary' => isset($data->wiki) ? self::formatLastFmText($data->wiki->summary) : '',
                'full' => isset($data->wiki) ? self::formatLastFmText($data->wiki->content) : '',
            ],
            tracks: array_map(static fn ($track): array => [
                'title' => $track->name,
                'length' => (int) $track->duration,
                'url' => $track->url,
            ], $data->tracks?->track ?? []),
        );
    }

    /** @return array<mixed> */
    public function toArray(): array
    {
        return [
            'url' => $this->url,
            'cover' => $this->cover,
            'wiki' => $this->wiki,
            'tracks' => $this->tracks,
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 c3ebc5a9179ea10ef9f0de8cccf83910
Eval Count 0
Decode Time 124 ms