Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/storage/DivinerLiveSymbol.php
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | public function attachBook(DivinerLiveBook $book) { | ||||
$this->book = $book; | $this->book = $book; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getAtom() { | public function getAtom() { | ||||
return $this->assertAttached($this->atom); | return $this->assertAttached($this->atom); | ||||
} | } | ||||
public function attachAtom(DivinerLiveAtom $atom) { | public function attachAtom(DivinerLiveAtom $atom = null) { | ||||
if ($atom === null) { | |||||
$this->atom = null; | |||||
} else { | |||||
$this->atom = DivinerAtom::newFromDictionary($atom->getAtomData()); | $this->atom = DivinerAtom::newFromDictionary($atom->getAtomData()); | ||||
} | |||||
return $this; | return $this; | ||||
joshuaspence: Is this the normal way to allow an attachable object to be nullable? It seemed odd to me. | |||||
} | } | ||||
public function getURI() { | public function getURI() { | ||||
$parts = array( | $parts = array( | ||||
'book', | 'book', | ||||
$this->getBook()->getName(), | $this->getBook()->getName(), | ||||
$this->getType(), | $this->getType(), | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | /* -( Markup Interface )--------------------------------------------------- */ | ||||
public function newMarkupEngine($field) { | public function newMarkupEngine($field) { | ||||
return PhabricatorMarkupEngine::getEngine('diviner'); | return PhabricatorMarkupEngine::getEngine('diviner'); | ||||
} | } | ||||
public function getMarkupText($field) { | public function getMarkupText($field) { | ||||
if (!$this->getAtom()) { | |||||
return; | |||||
} | |||||
return $this->getAtom()->getDocblockText(); | return $this->getAtom()->getDocblockText(); | ||||
} | } | ||||
public function didMarkupText( | public function didMarkupText( | ||||
$field, | $field, | ||||
$output, | $output, | ||||
PhutilMarkupEngine $engine) { | PhutilMarkupEngine $engine) { | ||||
Show All 27 Lines |
Is this the normal way to allow an attachable object to be nullable? It seemed odd to me.