Beispiel #1
0
 /**
  * Triggers an object event to all subscribers. Convenient wrapper on EM::publish
  *
  * @param string    $eventName
  * @param SeedEvent $event
  *
  * @return bool|int
  */
 public function trigger($eventName, $event = null)
 {
     if (null === $event) {
         $event = new SeedEvent($this);
     }
     return EventManager::trigger($eventName, $event);
 }
Beispiel #2
0
 /**
  * Plant the seed of life into Kisma!
  *
  * @param array $options
  *
  * @return bool
  */
 public static function conceive($options = array())
 {
     //	Set any passed in options...
     if (is_callable($options)) {
         $options = call_user_func($options);
     }
     //	Set any application-level options passed in
     static::$_options = Option::merge(static::$_options, $options);
     //	Register our faux-destructor
     if (false === ($_conceived = static::get(CoreSettings::CONCEPTION))) {
         \register_shutdown_function(function ($eventName = KismaEvents::DEATH) {
             \Kisma::__sleep();
             EventManager::trigger($eventName);
         });
         //	Try and detect the framework being used...
         Detector::framework();
         //	We done baby!
         static::set(CoreSettings::CONCEPTION, true);
         if (null === static::get(CoreSettings::AUTO_LOADER) && class_exists('\\ComposerAutoloaderInit', false)) {
             static::set(CoreSettings::AUTO_LOADER, \ComposerAutoloaderInit::getLoader());
         }
         //	And let the world know we're alive
         EventManager::trigger(KismaEvents::BIRTH);
     }
     //	Load any session data...
     static::__wakeup();
     return $_conceived;
 }