示例#1
0
 function array_set(array $set, $path, $value)
 {
     return Hash::set($set, $path, $value);
 }
示例#2
0
 /**
  * Set a parameter value by key.
  *
  * @uses Titon\Utility\Hash
  *
  * @param string $key
  * @param mixed $value
  * @return $this
  */
 public function set($key, $value = null)
 {
     if (strpos($key, '.') === false) {
         $this->_data[$key] = $value;
     } else {
         $this->_data = Hash::set($this->_data, $key, $value);
     }
     return $this;
 }
示例#3
0
 /**
  * Add values to the current loaded configuration.
  *
  * @uses Titon\Utility\Hash
  *
  * @param string $key
  * @param mixed $value
  */
 public static function set($key, $value)
 {
     static::$_config = Hash::set(static::$_config, $key, $value);
 }
示例#4
0
 /**
  * Test that set() inserts data into the set based on the dot notated path; an array can also be passed.
  */
 public function testSet()
 {
     $data = $this->expanded;
     $match = $data;
     $data = Hash::set($data, 'key', 'value');
     $match['key'] = 'value';
     $this->assertEquals($match, $data);
     $data = Hash::set($data, 'key.key', 'value');
     $match['key'] = array('key' => 'value');
     $this->assertEquals($match, $data);
     $data = Hash::set($data, array('key.key.key' => 'value', 'true' => true, 'one.false' => false));
     $match['key']['key'] = array('key' => 'value');
     $match['true'] = true;
     $match['one']['false'] = false;
     $this->assertEquals($match, $data);
 }