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\Rules; use App\Models\User; use Illuminate\Contracts\Validation\Rule..

Decoded Output download

<?php

namespace App\Rules;

use App\Models\User;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Arr;

class AllPlaylistsBelongToUser implements Rule
{
    public function __construct(private User $user)
    {
    }

    /** @param array<int> $value */
    public function passes($attribute, $value): bool
    {
        return array_diff(Arr::wrap($value), $this->user->playlists->pluck('id')->toArray()) === [];
    }

    public function message(): string
    {
        return 'Not all playlists belong to the user';
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace App\Rules;

use App\Models\User;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Arr;

class AllPlaylistsBelongToUser implements Rule
{
    public function __construct(private User $user)
    {
    }

    /** @param array<int> $value */
    public function passes($attribute, $value): bool
    {
        return array_diff(Arr::wrap($value), $this->user->playlists->pluck('id')->toArray()) === [];
    }

    public function message(): string
    {
        return 'Not all playlists belong to the user';
    }
}

Function Calls

None

Variables

None

Stats

MD5 ba9875796d242796db49e7c5a64d5a31
Eval Count 0
Decode Time 185 ms