mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-26 00:28:04 +08:00
53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace RainLoop\Providers;
|
||
|
|
||
|
class Settings extends \RainLoop\Providers\AbstractProvider
|
||
|
{
|
||
|
/**
|
||
|
* @var \RainLoop\Providers\Settings\SettingsInterface
|
||
|
*/
|
||
|
private $oDriver;
|
||
|
|
||
|
/**
|
||
|
* @param \RainLoop\Providers\Settings\SettingsInterface $oDriver
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function __construct(\RainLoop\Providers\Settings\SettingsInterface $oDriver)
|
||
|
{
|
||
|
$this->oDriver = $oDriver;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param \RainLoop\Account $oAccount
|
||
|
*
|
||
|
* @return \RainLoop\Settings
|
||
|
*/
|
||
|
public function Load(\RainLoop\Account $oAccount)
|
||
|
{
|
||
|
$oSettings = new \RainLoop\Settings();
|
||
|
$oSettings->InitData($this->oDriver->Load($oAccount));
|
||
|
return $oSettings;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param \RainLoop\Account $oAccount
|
||
|
* @param \RainLoop\Settings $oSettings
|
||
|
*
|
||
|
* @return bool
|
||
|
*/
|
||
|
public function Save(\RainLoop\Account $oAccount, \RainLoop\Settings $oSettings)
|
||
|
{
|
||
|
return $this->oDriver->Save($oAccount, $oSettings->DataAsArray());
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return bool
|
||
|
*/
|
||
|
public function IsActive()
|
||
|
{
|
||
|
return $this->oDriver instanceof \RainLoop\Providers\Settings\SettingsInterface;
|
||
|
}
|
||
|
}
|