/** * Returns the value of the requested config key * * @param string $name Path to the requested value like tree/node/classname * @param mixed $default Value returned if requested key isn't found * @return mixed Value associated to the requested key */ public function get($name, $default = null) { foreach ($this->prefixes as $prefix => $len) { if (strncmp($name, $prefix, $len) === 0) { return parent::get($name, $default); } } throw new \Aimeos\MW\Config\Exception(sprintf('Not allowed to access "%1$s" configuration', $name)); }
/** * Returns the value of the requested config key. * * @param string $name Path to the requested value like tree/node/classname * @param mixed $default Value returned if requested key isn't found * @return mixed Value associated to the requested key */ public function get($name, $default = null) { $name = trim($name, '/'); if (isset($this->negCache[$name])) { return $default; } if (array_key_exists($name, $this->cache)) { return $this->cache[$name]; } if (($value = $this->getValueFromArray($this->config, explode('/', $name))) === null) { $value = parent::get($name, null); } if ($value === null) { $this->negCache[$name] = true; return $default; } $this->cache[$name] = $value; return $value; }
/** * Returns the value of the requested config key. * * @param string $path Path to the requested value like tree/node/classname * @param mixed $default Value returned if requested key isn't found * @return mixed Value associated to the requested key */ public function get($path, $default = null) { $path = trim($path, '/'); // negative cache $success = false; apc_fetch('-' . $this->prefix . $path, $success); if ($success === true) { return $default; } // regular cache $success = false; $value = apc_fetch($this->prefix . $path, $success); if ($success === true) { return $value; } // not cached if (($value = parent::get($path, null)) === null) { apc_store('-' . $this->prefix . $path, null); return $default; } apc_store($this->prefix . $path, $value); return $value; }
/** * Returns the value of the requested config key. * * @param string $name Path to the requested value like tree/node/classname * @param mixed $default Value returned if requested key isn't found * @return mixed Value associated to the requested key */ public function get($name, $default = null) { $value = parent::get($name, $default); $this->file->set($name, $value, $default); return $value; }