
| Current Path : /proc/thread-self/root/usr/share/jj/app/libraries/RainLoop/Providers/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //proc/thread-self/root/usr/share/jj/app/libraries/RainLoop/Providers/Storage.php |
<?php
namespace RainLoop\Providers;
class Storage extends \RainLoop\Providers\AbstractProvider
{
/**
* @var \RainLoop\Providers\Storage\IStorage
*/
private $oDriver;
/**
* @return void
*/
public function __construct(\RainLoop\Providers\Storage\IStorage $oDriver)
{
$this->oDriver = $oDriver;
}
/**
* @param \RainLoop\Model\Account|string|null $mAccount
* @param int $iStorageType
*
* @return bool
*/
private function verifyAccount($mAccount, $iStorageType)
{
if (\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY !== $iStorageType &&
!($mAccount instanceof \RainLoop\Model\Account || \is_string($mAccount)))
{
return false;
}
return true;
}
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param string $sValue
*
* @return bool
*/
public function Put($oAccount, $iStorageType, $sKey, $sValue)
{
if (!$this->verifyAccount($oAccount, $iStorageType))
{
return false;
}
return $this->oDriver->Put($oAccount, $iStorageType, $sKey, $sValue);
}
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
* @param mixed $mDefault = false
*
* @return mixed
*/
public function Get($oAccount, $iStorageType, $sKey, $mDefault = false)
{
if (!$this->verifyAccount($oAccount, $iStorageType))
{
return $mDefault;
}
return $this->oDriver->Get($oAccount, $iStorageType, $sKey, $mDefault);
}
/**
* @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType
* @param string $sKey
*
* @return bool
*/
public function Clear($oAccount, $iStorageType, $sKey)
{
if (!$this->verifyAccount($oAccount, $iStorageType))
{
return false;
}
return $this->oDriver->Clear($oAccount, $iStorageType, $sKey);
}
/**
* @param \RainLoop\Model\Account|string $oAccount
*
* @return bool
*/
public function DeleteStorage($oAccount)
{
return $this->oDriver->DeleteStorage($oAccount);
}
/**
* @return bool
*/
public function IsActive()
{
return $this->oDriver instanceof \RainLoop\Providers\Storage\IStorage;
}
/**
* @return bool
*/
public function IsLocal()
{
return $this->oDriver instanceof \RainLoop\Providers\Storage\IStorage &&
$this->oDriver->IsLocal();
}
}