/**
  * @param \RainLoop\Settings $oSettings
  * @param string $sConfigName
  * @param string $sType = 'string'
  * @param callable|null $mStringCallback = null
  */
 private function setSettingsFromParams(&$oSettings, $sConfigName, $sType = 'string', $mStringCallback = null)
 {
     if ($this->HasActionParam($sConfigName)) {
         $sValue = $this->GetActionParam($sConfigName, '');
         switch ($sType) {
             default:
             case 'string':
                 $sValue = (string) $sValue;
                 if ($mStringCallback && is_callable($mStringCallback)) {
                     $sValue = call_user_func($mStringCallback, $sValue);
                 }
                 $oSettings->SetConf($sConfigName, (string) $sValue);
                 break;
             case 'int':
                 $iValue = (int) $sValue;
                 $oSettings->SetConf($sConfigName, $iValue);
                 break;
             case 'bool':
                 $oSettings->SetConf($sConfigName, '1' === (string) $sValue);
                 break;
         }
     }
 }
Beispiel #2
0
 /**
  * @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());
 }