snappymail/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php

53 lines
1 KiB
PHP
Raw Normal View History

<?php
namespace RainLoop\Providers;
class Settings extends \RainLoop\Providers\AbstractProvider
{
/**
* @var \RainLoop\Providers\Settings\ISettings
*/
private $oDriver;
/**
* @param \RainLoop\Providers\Settings\ISettings $oDriver
*
* @return void
*/
public function __construct(\RainLoop\Providers\Settings\ISettings $oDriver)
{
$this->oDriver = $oDriver;
}
/**
2014-11-13 06:09:14 +08:00
* @param \RainLoop\Model\Account $oAccount
*
* @return \RainLoop\Settings
*/
2014-11-13 06:09:14 +08:00
public function Load(\RainLoop\Model\Account $oAccount)
{
$oSettings = new \RainLoop\Settings();
$oSettings->InitData($this->oDriver->Load($oAccount));
return $oSettings;
}
/**
2014-11-13 06:09:14 +08:00
* @param \RainLoop\Model\Account $oAccount
* @param \RainLoop\Settings $oSettings
*
* @return bool
*/
2014-11-13 06:09:14 +08:00
public function Save(\RainLoop\Model\Account $oAccount, \RainLoop\Settings $oSettings)
{
return $this->oDriver->Save($oAccount, $oSettings->DataAsArray());
}
/**
* @return bool
*/
public function IsActive()
{
return $this->oDriver instanceof \RainLoop\Providers\Settings\ISettings;
}
}