Exemplo n.º 1
0
 /**
  * Remove header from collection
  *
  * @param  string $key The case-insensitive header name
  */
 public function remove($key)
 {
     parent::remove($this->normalizeKey($key));
 }
Exemplo n.º 2
0
 /**
  * Retrieve a single derived request attribute.
  *
  * Retrieves a single derived request attribute as described in
  * getAttributes(). If the attribute has not been previously set, returns
  * the default value as provided.
  *
  * This method obviates the need for a hasAttribute() method, as it allows
  * specifying a default value to return if the attribute is not found.
  *
  * @see getAttributes()
  * @param string $name The attribute name.
  * @param mixed $default Default value to return if the attribute does not exist.
  * @return mixed
  */
 public function getAttribute($name, $default = null)
 {
     return $this->attributes->get($name, $default);
 }
 public function testCount()
 {
     $this->property->setValue($this->bag, ['foo' => 'bar', 'abc' => '123']);
     $this->assertEquals(2, $this->bag->count());
 }
Exemplo n.º 4
0
 /**
  * Get settings for view engine
  *
  * @param \Slim\Collection $settings
  * @return array
  */
 private function getConfig($settings)
 {
     $key = 'view';
     $defaults = ['template_path' => APP_PATH . '/views', 'twig' => ['cache' => ROOT_PATH . '/tmp/cache/twig', 'debug' => false, 'auto_reload' => true]];
     return array_merge($defaults, $settings->get($key, []));
 }
Exemplo n.º 5
0
 /**
  * Set cookie
  *
  * The second argument may be a single scalar value, in which case
  * it will be merged with the default settings and considered the `value`
  * of the merged result.
  *
  * The second argument may also be an array containing any or all of
  * the keys shown in the default settings above. This array will be
  * merged with the defaults shown above.
  *
  * @param string $key   Cookie name
  * @param mixed  $value Cookie settings
  * @api
  */
 public function set($key, $value)
 {
     if (is_array($value)) {
         $settings = array_replace($this->defaults, $value);
     } else {
         $settings = array_replace($this->defaults, array('value' => $value));
     }
     parent::set($key, $settings);
 }
Exemplo n.º 6
0
 /**
  * Get config for logger
  *
  * @param \Slim\Collection $settings
  * @return array
  */
 private function getConfig($settings)
 {
     $key = 'logger';
     $defaults = [];
     return array_merge($defaults, $settings->get($key, []));
 }
Exemplo n.º 7
0
 /**
  * Constructor
  * @param  string $templateDirectory Path to template directory
  * @param  array  $items             Initialize set with these items
  * @api
  */
 public function __construct($templateDirectory, array $items = array())
 {
     $this->templateDirectory = rtrim($templateDirectory, DIRECTORY_SEPARATOR);
     parent::__construct($items);
 }
Exemplo n.º 8
0
 /**
  *
  * @param \Slim\Collection $settings
  */
 protected function getConfig($settings)
 {
     return array_merge($this->defaults, $settings->get($this->key, []));
 }