/** * Set a configuration element * * @param string * @param mixed * @return void */ public function __set($name, $value) { parent::__set($name, $value); //Only calculate the limit and offset if we have a total if ($this->total) { $this->limit = (int) max($this->limit, 1); $this->offset = (int) max($this->offset, 0); if ($this->limit > $this->total) { $this->offset = 0; } if (!$this->limit) { $this->offset = 0; $this->limit = $this->total; } $this->count = (int) ceil($this->total / $this->limit); if ($this->offset > $this->total) { $this->offset = ($this->count - 1) * $this->limit; } $this->current = (int) floor($this->offset / $this->limit) + 1; } }
/** * Set state value * * @param string The user-specified state name. * @param mixed The user-specified state value. * @return void */ public function __set($name, $value) { if (isset($this->_states[$name])) { $this->_states[$name]->value = $value; } return parent::__set($name, $value); }