コード例 #1
0
 /**
  * Magic "__get" method
  *
  * Allows the ability to arbitrarily request shared data from this instance
  * while treating it as an instance property
  *
  * @param string $key     The name of the shared data
  * @access public
  * @return string
  */
 public function __get($key)
 {
     return $this->shared_data->get($key);
 }
コード例 #2
0
 public function testArrayAccessSet()
 {
     // Test data
     $data = array('dog' => 'cooper');
     // Create our collection with NO data
     $data_collection = new DataCollection();
     // Set our data from our test data
     $data_collection[key($data)] = current($data);
     // Make sure the set worked
     $this->assertSame(current($data), $data_collection->get(key($data)));
 }