| Server IP : 185.252.147.100 / Your IP : 216.73.217.33 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/tour.mitrofanov.ru/public/wp-content/plugins/site-reviews/plugin/ |
Upload File : |
<?php
namespace GeminiLabs\SiteReviews;
use GeminiLabs\SiteReviews\Helpers\Cast;
trait Storage
{
protected Arguments $storage;
/**
* @param mixed $value
*/
public function append(string $property, $value, ?string $key = null): bool
{
$stored = $this->retrieve($property, []);
if (!is_array($stored)) {
return false;
}
if ($key) {
$stored[$key] = $value;
} else {
$stored[] = $value;
}
$this->store($property, $stored);
return true;
}
public function discard(string $property): void
{
unset($this->storage()->$property);
}
/**
* @param mixed $fallback
*
* @return mixed
*/
public function retrieve(string $property, $fallback = null)
{
return $this->storage()->get($property, $fallback);
}
/**
* @param mixed $fallback
*
* @return mixed
*/
public function retrieveAs(string $cast, string $property, $fallback = null)
{
return Cast::to($cast, $this->storage()->get($property, $fallback));
}
public function storage(): Arguments
{
if (!isset($this->storage)) {
$this->storage = new Arguments([]);
}
return $this->storage;
}
/**
* @param mixed $value
*/
public function store(string $property, $value): void
{
$this->storage()->set($property, $value);
}
}