/**
  * Returns an array of SiteLink objects for an item. If the item isn't known or not an Item,
  * an empty array is returned.
  *
  * @since 0.4
  *
  * @param ItemId $itemId
  *
  * @return SiteLink[]
  */
 public function getSiteLinksForItem(ItemId $itemId)
 {
     $cacheKey = $this->cacheKeyPrefix . ':sitelinks:' . $itemId->getSerialization();
     $siteLinks = $this->cache->get($cacheKey);
     if (!is_array($siteLinks)) {
         $siteLinks = $this->lookup->getSiteLinksForItem($itemId);
         $this->cache->set($cacheKey, $siteLinks, $this->cacheDuration);
     }
     return $siteLinks;
 }
 /**
  * @param ItemId $itemId
  *
  * @return SiteLink[]
  */
 private function getSiteLinks(ItemId $itemId)
 {
     return $this->siteLinkLookup->getSiteLinksForItem($itemId);
 }
 /**
  * Returns a usage lookup based on $siteLinklookup.
  * Local page IDs are spoofed using the numeric item ID as the local page ID.
  *
  * @param SiteLinkLookup $siteLinkLookup
  *
  * @return UsageLookup
  */
 private function getUsageLookup(SiteLinkLookup $siteLinkLookup)
 {
     $usageLookup = $this->getMock('Wikibase\\Client\\Usage\\UsageLookup');
     $usageLookup->expects($this->any())->method('getPagesUsing')->will($this->returnCallback(function ($ids) use($siteLinkLookup) {
         $pages = array();
         foreach ($ids as $id) {
             if (!$id instanceof ItemId) {
                 continue;
             }
             $links = $siteLinkLookup->getSiteLinksForItem($id);
             foreach ($links as $link) {
                 if ($link->getSiteId() === 'enwiki') {
                     // we use the numeric item id as the fake page id of the local page!
                     $usages = array(new EntityUsage($id, EntityUsage::SITELINK_USAGE), new EntityUsage($id, EntityUsage::LABEL_USAGE, 'en'));
                     $pages[] = new PageEntityUsages($id->getNumericId(), $usages);
                 }
             }
         }
         return new ArrayIterator($pages);
     }));
     return $usageLookup;
 }