コード例 #1
0
 public function normalizeAtomRef(DivinerAtomRef $ref)
 {
     if (!strlen($ref->getBook())) {
         $ref->setBook($this->getConfig('name'));
     }
     if ($ref->getBook() != $this->getConfig('name')) {
         // If the ref is from a different book, we can't normalize it.
         // Just return it as-is if it has enough information to resolve.
         if ($ref->getName() && $ref->getType()) {
             return $ref;
         } else {
             return null;
         }
     }
     $atom = $this->getPublisher()->findAtomByRef($ref);
     if ($atom) {
         return $atom->getRef();
     }
     return null;
 }
コード例 #2
0
ファイル: DivinerAtomRef.php プロジェクト: denghp/phabricator
 public static function newFromDictionary(array $dict)
 {
     $obj = new DivinerAtomRef();
     $obj->setBook(idx($dict, 'book'));
     $obj->setContext(idx($dict, 'context'));
     $obj->setType(idx($dict, 'type'));
     $obj->setName(idx($dict, 'name'));
     $obj->group = idx($dict, 'group');
     $obj->index = idx($dict, 'index');
     $obj->summary = idx($dict, 'summary');
     $obj->title = idx($dict, 'title');
     return $obj;
 }