public function config($config = null, $value = null) { if (DevValue::isEmpty($config)) { return $this->_config; } elseif (is_string($config)) { if (DevValue::isEmpty($value)) { return isset($this->_config[$config]) ? $this->_config[$config] : null; } if ((array_key_exists($config, $this->_config) || $this->is(State::DRAFT)) && !$this->is(State::READONLY)) { $this->_config[$config] = $value; } } elseif (is_array($config) && !$this->is(State::READONLY)) { $this->perform(State::BUSY); if ($this->is(State::DRAFT)) { foreach ($config as $a => $b) { $this->_config[$a] = $config[$a]; } } else { foreach ($this->_config as $a => $b) { if (isset($config[$a])) { $this->_config[$a] = $config[$a]; } } } $this->halt(State::BUSY); } }
public function write() { $source = $this->_source; $status = self::STATUS_FAILED; $data = DevValue::isEmpty($this->_contents) ? HTTP::jsonEncode($this->_data) : $this->_contents; $source->flush(); $source->contents($data); $source->write(); $status = self::STATUS_SUCCESS; $this->status($status); }
public function exists($var) { $fields = $this->fields(); $active_fields = $this->config('fields'); if ($var != '' && array_key_exists($var, $fields)) { if (DevValue::isEmpty($active_fields) || in_array($var, $active_fields)) { return true; } else { return false; } } else { return false; } return false; }