Skip to content

Instantly share code, notes, and snippets.

@bubach
Last active August 29, 2015 14:07
Show Gist options
  • Save bubach/84de88ebb85495d53df7 to your computer and use it in GitHub Desktop.
Save bubach/84de88ebb85495d53df7 to your computer and use it in GitHub Desktop.
Pure magic
<?php
/**
* main method of execution
*
* @access public
*/
public function run() {
// minimum to load rest
$this->setupAutoload();
$this->setupErrorHandling();
$this->config = new Core_Plugin_Config;
$this->load = new Core_Plugin_Load;
// profiling set asap
$this->load->getClass('Core_Plugin_Profiling', 'profiler');
$this->profiler->initProfiling();
// load events & setup classes
$this->load->getClass('Core_Plugin_Event', 'event');
$this->load->getClass('Core_Plugin_Setup', 'setup');
// our very first event
wmvc::app()->event->triggerEvent("wmvc_run_start", array("eventObject" => $this));
// setup Request & Routing
$this->setupRequest();
$this->setupRouting();
// setup & run controller->action
$this->setupControllerAction();
wmvc::app()->event->triggerEvent("wmvc_run_controller", array("eventObject" => $this));
$this->controller->{$this->action}();
// let profiling & events manipulate body before response
$this->profiler->stopProfiling();
wmvc::app()->event->triggerEvent("wmvc_run_end", array("eventObject" => $this));
// output the final product!
$this->controller->getResponse()->sendResponse();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment