callbacks() public static method

The callback array looks like this: {{code: php $callbacks = array( static method call array('Class_Name', 'method', $param1, $param2, ...), instance method call on a registry object array('registry-key', 'method', $param1, $param2, ...), instance method call array($object, 'method', $param1, $param2, ...), function call array(null, 'function', $param1, $param2, ...), file include, as in previous versions of Solar 'path/to/file.php', ); }}
See also: start()
See also: stop()
public static callbacks ( array $callbacks ) : void
$callbacks array The array of callbacks.
return void
Example #1
0
 public function testCallbacks_instanceMethod()
 {
     $file = Solar_Class::dir('Mock_Solar') . 'callbacks-instance-method.php';
     Solar_File::load($file);
     $instance = Solar::factory('Solar_Callbacks_Instance_Method');
     Solar::callbacks(array(array($instance, 'callback')));
     $this->assertTrue($GLOBALS['SOLAR_CALLBACKS_INSTANCE_METHOD']);
 }
Example #2
0
 /**
  * 
  * Stops Solar: runs stop scripts and cleans up the Solar environment.
  * 
  * @return void
  * 
  */
 public static function stop()
 {
     // run any 'stop' hook methods
     $hooks = Solar_Config::get('Solar', 'stop', array());
     Solar::callbacks($hooks);
     // unregister autoloader
     spl_autoload_unregister(array('Solar_Class', 'autoload'));
     // reset the status flag, and we're done.
     Solar::$_status = false;
 }