/**
  * @see UsageLookup::getUsagesForPage
  *
  * @param int $pageId
  *
  * @return EntityUsage[]
  * @throws UsageTrackerException
  */
 public function getUsagesForPage($pageId)
 {
     $usages = array();
     $title = $this->titleFactory->newFromID($pageId);
     $id = $this->siteLinkLookup->getItemIdForLink($this->clientSiteId, $title->getPrefixedText());
     if ($id !== null) {
         $usages[] = new EntityUsage($id, EntityUsage::SITELINK_USAGE);
     }
     return $usages;
 }
 public function testMakeTitleSafe()
 {
     $ns = NS_HELP;
     $name = 'TitleFactoryTest-testMakeTitleSafe';
     $fragment = 'Synopsis';
     $factory = new TitleFactory();
     $title = $factory->makeTitleSafe($ns, $name, $fragment);
     $this->assertEquals($ns, $title->getNamespace());
     $this->assertEquals($name, $title->getText());
     $this->assertEquals($fragment, $title->getFragment());
 }
 /**
  * @param ResultWrapper|array $rows
  *
  * @return Title[]
  */
 private function getChangedTitles($rows)
 {
     $titles = array();
     foreach ($rows as $row) {
         $titles[] = $this->titleFactory->makeTitle($row->rc_namespace, $row->rc_title);
     }
     return $titles;
 }
 /**
  * @param string[] $names
  *
  * @return Title[]
  */
 private function getTitlesFromTexts(array $names)
 {
     $titles = array();
     foreach ($names as $name) {
         try {
             $titles[] = $this->titleFactory->newFromText($name);
         } catch (StorageException $ex) {
             // Invalid title in the diff? Skip.
         }
     }
     return $titles;
 }
 /**
  * @param int[] $pageIds
  *
  * @return Title[]
  */
 private function getTitlesForPageIds(array $pageIds)
 {
     $titles = array();
     foreach ($pageIds as $id) {
         try {
             $title = $this->titleFactory->newFromID($id);
             $titles[] = $title;
         } catch (Exception $ex) {
             // No title for that ID, maybe the page got deleted just now.
         }
     }
     return $titles;
 }