Пример #1
0
 public function testGet()
 {
     $this->storage = array('foo' => array('baz' => 'bad', 'qux' => array('nux' => 'bud')), 'dux' => array('tuq' => array('jux' => 'dum')));
     $this->assertEquals(DotArray::get($this->storage, 'foo.baz'), 'bad');
     $this->assertEquals(DotArray::get($this->storage, 'foo.qux.nux'), 'bud');
     $this->assertEquals(DotArray::get($this->storage, 'dux.tuq.jux'), 'dum');
 }
Пример #2
0
 /**
  * Get config value
  * @param string key
  * @return $value
  */
 public function get($key, $default = null)
 {
     if (!$this->has($key)) {
         return $default;
     }
     return \Exedra\Support\DotArray::get($this->storage, $key);
 }
Пример #3
0
 /**
  * Get the session by the given key.
  * Default on null
  * @param string key
  * @param session value
  * @return mixed
  */
 public function get($key, $default = null)
 {
     $data = \Exedra\Support\DotArray::get($this->getStorage(), $key);
     return $data === null ? $default : $data;
 }
Пример #4
0
 /**
  * Get execution parameter
  * @param string name
  * @param mixed default value (optional)
  * @return mixed or default if not found.
  */
 public function param($name, $default = null)
 {
     return \Exedra\Support\DotArray::has($this->params, $name) ? \Exedra\Support\DotArray::get($this->params, $name) : $default;
 }