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\Casts; use App\Values\UserPreferences; use Illuminate\Contracts\Data..
Decoded Output download
<?php
namespace App\Casts;
use App\Values\UserPreferences;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Support\Arr;
class UserPreferencesCast implements CastsAttributes
{
public function get($model, string $key, $value, array $attributes): UserPreferences
{
$arr = json_decode($value, true) ?: [];
return UserPreferences::make(Arr::get($arr, 'lastfm_session_key'));
}
/** @param UserPreferences|null $value */
public function set($model, string $key, $value, array $attributes): ?string
{
return json_encode($value ?: []);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Casts;
use App\Values\UserPreferences;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Support\Arr;
class UserPreferencesCast implements CastsAttributes
{
public function get($model, string $key, $value, array $attributes): UserPreferences
{
$arr = json_decode($value, true) ?: [];
return UserPreferences::make(Arr::get($arr, 'lastfm_session_key'));
}
/** @param UserPreferences|null $value */
public function set($model, string $key, $value, array $attributes): ?string
{
return json_encode($value ?: []);
}
}
Function Calls
| None |
Stats
| MD5 | 47adafc7ef63b2935be599a18bbce445 |
| Eval Count | 0 |
| Decode Time | 78 ms |