ecom
E-commerce cms
 All Data Structures Namespaces Files Functions Variables
AModule.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Tools;
4 
9 abstract class AModule
10 {
17  private $context;
18 
22  private $entity;
23 
28  public abstract function install();
29 
33  public function uninstall()
34  { }
35 
41  public abstract function doAction($event);
42 
48  public abstract function doShortCode($shortCode, $params);
49 
56  public function setContext($context)
57  {
58  if ($this->context === null)
59  $this->context = $context;
60  }
61 
68  public function setEntity($entity)
69  {
70  if ($this->entity === null)
71  $this->entity = $entity;
72  }
73 
78  public static function registerHook($hookName)
79  {
80  $this->context->hooks->register($this, $hookname);
81  }
82 
86  public function __get($key)
87  {
88  switch ($key)
89  {
90  case "context": return $this->context; break;
91  case "entity": return $this->entity; break;
92  }
93  throw new \Exception("Cannot access attribute {$key}");
94  }
95 }
96 
__get($key)
Definition: AModule.php:86
setContext($context)
Definition: AModule.php:56
static registerHook($hookName)
Definition: AModule.php:78
setEntity($entity)
Definition: AModule.php:68