-
- /**
- * Implements Observer
- * @param \SplSubject $ctl \http\Controller
- */
- public function update(\SplSubject $ctl) {
- /* @var http\Controller $ctl */
- $pld = $this->createPayload($ctl);
- $ctl[Observer\View::class] = function() use($pld) {
- return $pld;
- };
-
- if (!isset($pld->ref) || !strlen($pld->ref)) {
- /* front page */
- return;
- }
-
- $cnn = null;
- if (($repo = $this->reference->getRepoForEntry($pld->ref, $cnn))) {
- if (strlen($cnn)) {
- /* redirect */
- $this->serveCanonical($ctl, $cnn);
- } else {
- /* direct match */
- $pld->entry = $repo->getEntry($pld->ref);
+
+ private function serve() {
+ extract((array) func_get_arg(0));
+ include ROOT."/views/layout.phtml";
+ $this->response->send();
+ }
+
+ public function handle() {
+ try {
+
+ $pld = $this->createPayload();
+
+ if (strlen($pld->ref)) {
+ $cnn = null;
+ if (($repo = $this->reference->getRepoForEntry($pld->ref, $cnn))) {
+ if (strlen($cnn)) {
+ /* redirect */
+ return $this->serveCanonical($cnn);
+ } else {
+ /* direct match */
+ $pld->entry = $repo->getEntry($pld->ref);
+ }
+ } elseif (!$this->servePreset($pld)) {
+ return;
+ }