load() public method

Instantiate the reflected object using the parsed contructor args and set extra options if any
public load ( ) : mixed
return mixed Instance of the reflected object
 public function testLoad()
 {
     $options = array('class' => 'Cascade\\Tests\\Fixtures\\SampleClass', 'mandatory' => 'someValue', 'optional_X' => 'testing some stuff', 'optional_Y' => 'testing other stuff', 'hello' => 'hello', 'there' => 'there');
     ClassLoader::$extraOptionHandlers = array('*' => array('hello' => function ($instance, $value) {
         $instance->setHello(strtoupper($value));
     }), 'Cascade\\Tests\\Fixtures\\SampleClass' => array('there' => function ($instance, $value) {
         $instance->setThere(strtoupper($value) . '!!!');
     }));
     $loader = new ClassLoader($options);
     $instance = $loader->load();
     $expectedInstance = new SampleClass('someValue');
     $expectedInstance->optionalX('testing some stuff');
     $expectedInstance->optionalY = 'testing other stuff';
     $expectedInstance->setHello('HELLO');
     $expectedInstance->setThere('THERE!!!');
     $this->assertEquals($expectedInstance, $instance);
 }
 /**
  * Test a nested class to load
  */
 public function testLoadDependency()
 {
     $options = array('class' => 'Cascade\\Tests\\Fixtures\\DependentClass', 'dependency' => array('class' => 'Cascade\\Tests\\Fixtures\\SampleClass', 'mandatory' => 'someValue'));
     $loader = new ClassLoader($options);
     $instance = $loader->load();
     $expectedInstance = new DependentClass(new SampleClass('someValue'));
     $this->assertEquals($expectedInstance, $instance);
 }
 /**
  * Recursively loads objects into any of the rawOptions that represent
  * a class
  */
 protected function loadChildClasses()
 {
     foreach ($this->rawOptions as &$option) {
         if (is_array($option) && array_key_exists('class', $option) && class_exists($option['class'])) {
             $classLoader = new ClassLoader($option);
             $option = $classLoader->load();
         }
     }
 }