/** * */ public function __construct() { parent::__construct(); // set package name and namespace $parts = explode('\\', get_class($this)); $pkgName = strtolower($parts[0] . '/' . $parts[1]); $this->setComposerName($pkgName); $this->setNamespace($parts[0] . '\\' . $parts[1]); // unique key. being used when dumping package's assets $this->key = sha1(get_class($this)); // every package has its own factory. extensions created by facade will // inherit application's factory. $this->setFactory(new Factory\Factory($this)); // not all packages are being created by the facade so we have to assign // application instance explicitly //$this->setApplication(AbstractFacade::getApplication()); $this->init(); // assign event listeners $this->addEventListener(Event\Type\System\Build::toType(), function ($event) { //var_dump($this->getNamespace());exit; $this->onBuildEvent($event); }); $this->addEventListener(Event\Type\System\PkgNotification::toType(), function ($event) { switch ($event->getNotifWord()) { case 'load-config-file': $this->loadConfigFile(); break; case 'init-routing': $this->initRouting(); break; } }); }
/** * @api */ public function __construct(Contract\Cache $cache, Contract\Session $session) { parent::__construct(); $this->session = $session; $this->cache = $cache; }