public function set($name, $value) { $name = (string) $name; if ($this->propertyExists($name, 'set')) { return parent::set($name, $value); } return $this->_setByKey($name, $value, $GLOBALS[$this->_getSourceName()]); }
/** * Set setting value * * Set the setting value to the one specified. If a setting with the name * specified is not found, it will be created: * <code> $params->set('foo.bar', 'baz');</code> * * @uses AeSettings_Driver::$_namePattern * * @throws AeSettingsDriverException #400 if setting name is invalid * * @param string $name setting name * @param mixed $value new setting value * * @return bool true on success, false otherwise */ public function set($name, $value) { $name = (string) $name; if ($this->propertyExists($name, 'set')) { return parent::set($name, $value); } if (!preg_match($this->_namePattern, $name)) { throw new AeSettingsDriverException('Setting name is invalid', 400); } if (strpos($name, '.')) { list($section, $name) = explode('.', $name, 2); } else { $section = $this->section; } if ($value instanceof AeType) { $value = $value->getValue(); } return parent::set($section . '.' . $name, $value); }
/** * Set session variable * * Sets the session variable, identified by the <var>$name</var> parameter, * to the value passed * * @uses AeSession::_check() to check for session state * * @throws AeSessionException #403 if session validation failed * @throws AeSessionException #408 if session has expired * @throws AeSessionException #412 if session has been destroyed * * @param string $name * @param mixed $value * * @return AeSession self */ public function set($name, $value) { $name = (string) $name; if ($this->propertyExists($name, 'set')) { return parent::set($name, $value); } $this->_check(); if (!preg_match($this->_keyPattern, $name)) { throw new AeSessionException('Key name is invalid', 400); } return $this->_setByKey((string) $name, $value, $_SESSION); }