| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | -* | |
| 3 | +* | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | //Import dependencies. |
| 7 | 7 | require_once 'observer.interface.php'; |
| @@ -6,79 +6,79 @@ | ||
| 6 | 6 | //Import dependencies. |
| 7 | 7 | require_once 'observer.interface.php'; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | -* | |
| 10 | +* | |
| 11 | 11 | */ |
| 12 | 12 | abstract class CJTObserver implements CJTIObserver { |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * | |
| 15 | + * | |
| 16 | 16 | */ |
| 17 | 17 | const CALLBACK_CLASS = 0; |
| 18 | - | |
| 18 | + | |
| 19 | 19 | /** |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | */ |
| 22 | 22 | const CALLBACK_METHOD = 1; |
| 23 | - | |
| 23 | + | |
| 24 | 24 | /** |
| 25 | - * | |
| 25 | + * | |
| 26 | 26 | */ |
| 27 | 27 | const REDIRECT_MODE_PERMANENT = 0; |
| 28 | - | |
| 28 | + | |
| 29 | 29 | /** |
| 30 | 30 | * put your comment there... |
| 31 | - * | |
| 31 | + * | |
| 32 | 32 | * @var mixed |
| 33 | 33 | */ |
| 34 | 34 | protected $callback; |
| 35 | - | |
| 35 | + | |
| 36 | 36 | /** |
| 37 | 37 | * put your comment there... |
| 38 | - * | |
| 38 | + * | |
| 39 | 39 | * @var mixed |
| 40 | 40 | */ |
| 41 | 41 | protected $filter; |
| 42 | - | |
| 42 | + | |
| 43 | 43 | /** |
| 44 | 44 | * put your comment there... |
| 45 | - * | |
| 45 | + * | |
| 46 | 46 | * @var mixed |
| 47 | 47 | */ |
| 48 | 48 | protected $key; |
| 49 | - | |
| 49 | + | |
| 50 | 50 | /** |
| 51 | 51 | * put your comment there... |
| 52 | - * | |
| 52 | + * | |
| 53 | 53 | * @var mixed |
| 54 | 54 | */ |
| 55 | 55 | protected $name; |
| 56 | - | |
| 56 | + | |
| 57 | 57 | /** |
| 58 | 58 | * put your comment there... |
| 59 | - * | |
| 59 | + * | |
| 60 | 60 | * @var mixed |
| 61 | 61 | */ |
| 62 | 62 | protected $param; |
| 63 | - | |
| 63 | + | |
| 64 | 64 | /** |
| 65 | 65 | * put your comment there... |
| 66 | - * | |
| 66 | + * | |
| 67 | 67 | * @var mixed |
| 68 | 68 | */ |
| 69 | 69 | protected $params; |
| 70 | - | |
| 70 | + | |
| 71 | 71 | /** |
| 72 | 72 | * put your comment there... |
| 73 | - * | |
| 73 | + * | |
| 74 | 74 | * @var mixed |
| 75 | 75 | */ |
| 76 | 76 | protected $subject; |
| 77 | - | |
| 77 | + | |
| 78 | 78 | /** |
| 79 | 79 | * put your comment there... |
| 80 | - * | |
| 80 | + * | |
| 81 | 81 | * @param mixed $name |
| 82 | 82 | * @return CJTObserver |
| 83 | 83 | */ |
| 84 | 84 | public function __construct($name, $filter = null) { |
| @@ -84,30 +84,30 @@ | ||
| 84 | 84 | public function __construct($name, $filter = null) { |
| 85 | 85 | $this->name = $name; |
| 86 | 86 | $this->filter = $filter; |
| 87 | 87 | } |
| 88 | - | |
| 88 | + | |
| 89 | 89 | /** |
| 90 | 90 | * put your comment there... |
| 91 | - * | |
| 91 | + * | |
| 92 | 92 | */ |
| 93 | 93 | public function getCallback($component = self::CALLBACK_CLASS) { |
| 94 | 94 | $component = ($component !== null) ? $this->callback[$component] : $this->callback; |
| 95 | 95 | return $component; |
| 96 | 96 | } |
| 97 | - | |
| 97 | + | |
| 98 | 98 | /** |
| 99 | 99 | * put your comment there... |
| 100 | - * | |
| 100 | + * | |
| 101 | 101 | * @param mixed $name |
| 102 | 102 | */ |
| 103 | 103 | public function getFilter($name) { |
| 104 | - return $this->filter[$name]; | |
| 104 | + return $this->filter[$name]; | |
| 105 | 105 | } |
| 106 | - | |
| 106 | + | |
| 107 | 107 | /** |
| 108 | 108 | * put your comment there... |
| 109 | - * | |
| 109 | + * | |
| 110 | 110 | * @param mixed $observer |
| 111 | 111 | */ |
| 112 | 112 | public static function getInstance($subject, $callback) { |
| 113 | 113 | if (is_object($callback)) { |
| @@ -141,20 +141,20 @@ | ||
| 141 | 141 | $observer->init($subject, $callback, $param); |
| 142 | 142 | } |
| 143 | 143 | return $observer; |
| 144 | 144 | } |
| 145 | - | |
| 145 | + | |
| 146 | 146 | /** |
| 147 | 147 | * put your comment there... |
| 148 | - * | |
| 148 | + * | |
| 149 | 149 | */ |
| 150 | 150 | public function getKey() { |
| 151 | - return $this->key; | |
| 151 | + return $this->key; | |
| 152 | 152 | } |
| 153 | - | |
| 153 | + | |
| 154 | 154 | /** |
| 155 | 155 | * put your comment there... |
| 156 | - * | |
| 156 | + * | |
| 157 | 157 | */ |
| 158 | 158 | public function getName() { |
| 159 | 159 | return $this->name; |
| 160 | 160 | } |
| @@ -160,33 +160,33 @@ | ||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * put your comment there... |
| 164 | - * | |
| 164 | + * | |
| 165 | 165 | */ |
| 166 | 166 | public function getParam() { |
| 167 | - return $this->param; | |
| 167 | + return $this->param; | |
| 168 | 168 | } |
| 169 | - | |
| 169 | + | |
| 170 | 170 | /** |
| 171 | 171 | * put your comment there... |
| 172 | - * | |
| 172 | + * | |
| 173 | 173 | */ |
| 174 | 174 | public function getSubject() { |
| 175 | - return $this->subject; | |
| 175 | + return $this->subject; | |
| 176 | 176 | } |
| 177 | - | |
| 177 | + | |
| 178 | 178 | /** |
| 179 | 179 | * put your comment there... |
| 180 | - * | |
| 180 | + * | |
| 181 | 181 | */ |
| 182 | 182 | public function getTarget() { |
| 183 | 183 | return $this->getSubject()->getTarget(); |
| 184 | 184 | } |
| 185 | - | |
| 185 | + | |
| 186 | 186 | /** |
| 187 | 187 | * put your comment there... |
| 188 | - * | |
| 188 | + * | |
| 189 | 189 | * @param mixed $subject |
| 190 | 190 | * @param mixed $callback |
| 191 | 191 | */ |
| 192 | 192 | protected function init($subject, $callback, $param) { |
| @@ -196,12 +196,12 @@ | ||
| 196 | 196 | $this->param = $param; |
| 197 | 197 | // Chain! |
| 198 | 198 | return $this; |
| 199 | 199 | } |
| 200 | - | |
| 200 | + | |
| 201 | 201 | /** |
| 202 | 202 | * put your comment there... |
| 203 | - * | |
| 203 | + * | |
| 204 | 204 | * @param mixed $callback |
| 205 | 205 | * @param mixed $mode |
| 206 | 206 | */ |
| 207 | 207 | public function redirect($callback, $mode = self::REDIRECT_MODE_PERMANENT) { |
| @@ -221,18 +221,18 @@ | ||
| 221 | 221 | break; |
| 222 | 222 | } |
| 223 | 223 | return $this->redirectReturn(); |
| 224 | 224 | } |
| 225 | - | |
| 225 | + | |
| 226 | 226 | /** |
| 227 | 227 | * put your comment there... |
| 228 | - * | |
| 228 | + * | |
| 229 | 229 | */ |
| 230 | 230 | protected abstract function redirectReturn(); |
| 231 | - | |
| 231 | + | |
| 232 | 232 | /** |
| 233 | 233 | * put your comment there... |
| 234 | - * | |
| 234 | + * | |
| 235 | 235 | */ |
| 236 | 236 | public function trigger() { |
| 237 | 237 | $this->params = func_get_args(); |
| 238 | 238 | // Callback! |
| @@ -238,6 +238,6 @@ | ||
| 238 | 238 | // Callback! |
| 239 | 239 | $return = call_user_func_array($this->callback, $this->params); |
| 240 | 240 | return $return; |
| 241 | 241 | } |
| 242 | - | |
| 242 | + | |
| 243 | 243 | } // End class |