Beispiel #1
0
 /**
  * @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.');
 }
Beispiel #2
0
 /**
  * @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);
 }
Beispiel #3
0
 /**
  * @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;
 }
Beispiel #5
0
 /**
  * @param string $name
  *
  * @return string
  */
 public function getAction($name)
 {
     $route = $this->routes->get($name);
     return $route[self::ACTION];
 }
Beispiel #6
0
 public function testGetStoreSetValue()
 {
     $config = new Store();
     $config->set('test', 'foo');
     $this->assertSame('foo', $config->get('test'));
 }
Beispiel #7
0
 /**
  * @return string
  */
 public static function getLocale()
 {
     return static::$store->get('locale');
 }