/** * @param string $key * * @return mixed * * @throws NotExistsException */ public function get($key) { if ($this->exists($key)) { return $this->attributes->get($key); } throw new NotExistsException('Field "' . $key . '" not exists.'); }
/** * @return Routes */ public function getRoutes() { $store = new Store(require ROOT . '/config/routes.php'); $routes = new Store($store->get(Routes::ROUTES)); $controllerDirectories = new Store($store->get(Routes::CONTROLLER_DIRECTORIES)); return new Routes($routes, $controllerDirectories); }
/** * @param array $values */ public function setValues(array $values) { foreach ($values as $key => $value) { $element = $this->elements->get($key); $element->setValue($value); } }
/** * @param string $value * @return ElementContainer */ public function setValue($value) { if (is_null($this->elements->get('control'))) { if (is_array($value)) { // checkboxes foreach ($value as $v) { $this->elements->get($this->getId() . '_' . $v)->setValue($v); } } else { // radio $this->elements->get($this->getId() . '_' . $value)->setValue($value); } } else { // default input field $this->elements->get('control')->setValue($value); } return $this; }
/** * @param string $name * * @return string */ public function getAction($name) { $route = $this->routes->get($name); return $route[self::ACTION]; }
public function testGetStoreSetValue() { $config = new Store(); $config->set('test', 'foo'); $this->assertSame('foo', $config->get('test')); }
/** * @return string */ public static function getLocale() { return static::$store->get('locale'); }