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 Livewire\Features\SupportSession; use Livewire\Features\SupportAttribute..
Decoded Output download
<?php
namespace Livewire\Features\SupportSession;
use Livewire\Features\SupportAttributes\Attribute as LivewireAttribute;
use Illuminate\Support\Facades\Session;
use Attribute;
#[Attribute(Attribute::TARGET_PROPERTY)]
class BaseSession extends LivewireAttribute
{
function __construct(
protected $key = null,
) {}
public function mount($params)
{
if (! $this->exists()) return;
$fromSession = $this->read();
$this->setValue($fromSession);
}
public function dehydrate($context)
{
$this->write();
}
protected function exists()
{
return Session::exists($this->key());
}
protected function read()
{
return Session::get($this->key());
}
protected function write()
{
Session::put($this->key(), $this->getValue());
}
protected function key()
{
if (! $this->key) {
return (string) 'lw' . crc32($this->component->getName() . $this->getName());
}
return self::replaceDynamicPlaceholders($this->key, $this->component);
}
static function replaceDynamicPlaceholders($key, $component)
{
return preg_replace_callback('/\{(.*)\}/U', function ($matches) use ($component) {
return data_get($component, $matches[1], function () use ($matches) {
throw new \Exception('Unable to evaluate dynamic session key placeholder: '.$matches[0]);
});
}, $key);
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Livewire\Features\SupportSession;
use Livewire\Features\SupportAttributes\Attribute as LivewireAttribute;
use Illuminate\Support\Facades\Session;
use Attribute;
#[Attribute(Attribute::TARGET_PROPERTY)]
class BaseSession extends LivewireAttribute
{
function __construct(
protected $key = null,
) {}
public function mount($params)
{
if (! $this->exists()) return;
$fromSession = $this->read();
$this->setValue($fromSession);
}
public function dehydrate($context)
{
$this->write();
}
protected function exists()
{
return Session::exists($this->key());
}
protected function read()
{
return Session::get($this->key());
}
protected function write()
{
Session::put($this->key(), $this->getValue());
}
protected function key()
{
if (! $this->key) {
return (string) 'lw' . crc32($this->component->getName() . $this->getName());
}
return self::replaceDynamicPlaceholders($this->key, $this->component);
}
static function replaceDynamicPlaceholders($key, $component)
{
return preg_replace_callback('/\{(.*)\}/U', function ($matches) use ($component) {
return data_get($component, $matches[1], function () use ($matches) {
throw new \Exception('Unable to evaluate dynamic session key placeholder: '.$matches[0]);
});
}, $key);
}
}
Function Calls
None |
Stats
MD5 | cbcf7067ba0edc365a6d1db252ffdb91 |
Eval Count | 0 |
Decode Time | 82 ms |