|
Revision 1598, 2.3 kB
(checked in by mikey, 1 month ago)
|
add construction template method to prevent constructor overloading
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
stubClassLoader::load('net::stubbles::websites::memphis::stubMemphisExtension'); |
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
abstract class stubMemphisAbstractExtension extends stubBaseObject implements stubMemphisExtension |
|---|
| 17 |
{ |
|---|
| 18 |
|
|---|
| 19 |
* access to request |
|---|
| 20 |
* |
|---|
| 21 |
* @var stubRequest |
|---|
| 22 |
*/ |
|---|
| 23 |
protected $request; |
|---|
| 24 |
|
|---|
| 25 |
* access to session |
|---|
| 26 |
* |
|---|
| 27 |
* @var stubSession |
|---|
| 28 |
*/ |
|---|
| 29 |
protected $session; |
|---|
| 30 |
|
|---|
| 31 |
* access to response |
|---|
| 32 |
* |
|---|
| 33 |
* @var stubResponse |
|---|
| 34 |
*/ |
|---|
| 35 |
protected $response; |
|---|
| 36 |
|
|---|
| 37 |
* access to context |
|---|
| 38 |
* |
|---|
| 39 |
* @var array<string,mixed> |
|---|
| 40 |
*/ |
|---|
| 41 |
protected $context; |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
* constructor |
|---|
| 45 |
* |
|---|
| 46 |
* @param stubRequest $request the request data |
|---|
| 47 |
* @param stubSession $session current session |
|---|
| 48 |
* @param stubResponse $response contains response data |
|---|
| 49 |
* @Inject |
|---|
| 50 |
*/ |
|---|
| 51 |
public function __construct(stubRequest $request, stubSession $session, stubResponse $response) |
|---|
| 52 |
{ |
|---|
| 53 |
$this->request = $request; |
|---|
| 54 |
$this->session = $session; |
|---|
| 55 |
$this->response = $response; |
|---|
| 56 |
$this->doConstruct(); |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
* optional template method to do some constructor work in derived classes |
|---|
| 61 |
*/ |
|---|
| 62 |
protected function doConstruct() |
|---|
| 63 |
{ |
|---|
| 64 |
|
|---|
| 65 |
} |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
* sets the context |
|---|
| 69 |
* |
|---|
| 70 |
* @param array $context additional context data |
|---|
| 71 |
* @Inject |
|---|
| 72 |
* @Named('context') |
|---|
| 73 |
*/ |
|---|
| 74 |
public function setContext(array $context) |
|---|
| 75 |
{ |
|---|
| 76 |
$this->context = $context; |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
* checks whether extension is cachable or not |
|---|
| 81 |
* |
|---|
| 82 |
* @return bool |
|---|
| 83 |
*/ |
|---|
| 84 |
public function isCachable() |
|---|
| 85 |
{ |
|---|
| 86 |
return true; |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
* returns a list of variables that have an influence on caching |
|---|
| 91 |
* |
|---|
| 92 |
* @return array<string,scalar> |
|---|
| 93 |
*/ |
|---|
| 94 |
public function getCacheVars() |
|---|
| 95 |
{ |
|---|
| 96 |
return array(); |
|---|
| 97 |
} |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
* returns a list of files used to create the content |
|---|
| 101 |
* |
|---|
| 102 |
* @return array<string> |
|---|
| 103 |
*/ |
|---|
| 104 |
public function getUsedFiles() |
|---|
| 105 |
{ |
|---|
| 106 |
return array(); |
|---|
| 107 |
} |
|---|
| 108 |
} |
|---|
| 109 |
?> |
|---|