示例#1
0
 /**
  * set data to the object.
  *
  * @param string 	$key
  * @param mixed		$value
  * @param mixed 		$param
  *
  * @return void
  */
 public function set($key, $value, $param = null)
 {
     CCArr::set($key, $value, $this->_data);
 }
示例#2
0
文件: CCArr.php 项目: clancats/core
 /**
  * test the CCArr setter
  */
 public function testArraySetItem()
 {
     $test_array = $this->test_array;
     /*
      * set string
      */
     CCArr::set('string', 'batz', $test_array);
     $this->assertEquals(CCArr::get('string', $test_array), 'batz');
     /*
      * set number
      */
     CCArr::set('array.number', 0, $test_array);
     $this->assertEquals(CCArr::get('array.number', $test_array), 0);
     /*
      * set new value
      */
     CCArr::set('not.existing.item', 'new value', $test_array);
     $this->assertEquals(CCArr::get('not.existing.item', $test_array), 'new value');
     /*
      * set value in deep field
      */
     CCArr::set('not.existing.item.in.deep.deep.field', 'deep', $test_array);
     $this->assertEquals(CCArr::get('not.existing.item.in.deep.deep.field', $test_array), 'deep');
 }
示例#3
0
文件: CCView.php 项目: clancats/core
 /**
  * custom setter with encode ability
  *
  * @param string 	$key
  * @param mixed		$value
  * @param mixed 		$param
  * @return void
  */
 public function set($key, $value, $param = null)
 {
     if ($param === true) {
         $value = CCStr::htmlentities($value);
     }
     return CCArr::set($key, $value, $this->_data);
 }