1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 03:02:43 +01:00
phorge-phorge/src/applications/diviner/renderer/DivinerRenderer.php
epriestley b0a5f42244 Add "live" publisher and storage to Diviner
Summary:
Ref T988. This adds basics for the non-static publishing target:

  - Storage (called "Live", e.g. `DivinerLiveAtom` to distinguish it from shared classes like `DivinerAtom`).
  - Mostly populate the storage.
  - Some minor fixes and improvements.

Test Plan: Generated docs, looked at DB, saw mostly-sensible output.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T988

Differential Revision: https://secure.phabricator.com/D5973
2013-05-20 10:18:26 -07:00

40 lines
920 B
PHP

<?php
abstract class DivinerRenderer {
private $publisher;
private $atomStack = array();
public function setPublisher($publisher) {
$this->publisher = $publisher;
return $this;
}
public function getPublisher() {
return $this->publisher;
}
public function getConfig($key, $default = null) {
return $this->getPublisher()->getConfig($key, $default);
}
protected function pushAtomStack(DivinerAtom $atom) {
$this->atomStack[] = $atom;
return $this;
}
protected function peekAtomStack() {
return end($this->atomStack);
}
protected function popAtomStack() {
array_pop($this->atomStack);
return $this;
}
abstract public function renderAtom(DivinerAtom $atom);
abstract public function renderAtomSummary(DivinerAtom $atom);
abstract public function renderAtomIndex(array $refs);
abstract public function getHrefForAtomRef(DivinerAtomRef $ref);
}