/** * Remove header from collection * * @param string $key The case-insensitive header name */ public function remove($key) { parent::remove($this->normalizeKey($key)); }
/** * 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()); }
/** * 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, [])); }
/** * 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); }
/** * Get config for logger * * @param \Slim\Collection $settings * @return array */ private function getConfig($settings) { $key = 'logger'; $defaults = []; return array_merge($defaults, $settings->get($key, [])); }
/** * 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); }
/** * * @param \Slim\Collection $settings */ protected function getConfig($settings) { return array_merge($this->defaults, $settings->get($this->key, [])); }