Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getGoogleBooksVolumeLink()
 {
     $isbn = $this->recordDriver->getISBNs()[0];
     $lccn = $this->recordDriver->getLCCN();
     $oclc = $this->recordDriver->getCleanOCLCNum();
     if (!$isbn && !$lccn && !$oclc) {
         return false;
     }
     $url = 'https://www.googleapis.com/books/v1/volumes';
     if ($isbn) {
         $params = array('q' => 'isbn:' . str_replace("-", "", $isbn));
     }
     if ($lccn) {
         $params = array('q' => 'lccn:' . str_replace("-", "", $lccn));
     }
     if ($oclc) {
         $params = array('q' => 'oclc:' . str_replace("-", "", $oclc));
     }
     $dataArray = $this->getRequestDataResponseAsArray($url, $params);
     $link = $dataArray['items'][0]['volumeInfo']['canonicalVolumeLink'];
     if (!isset($link) || empty($link)) {
         return null;
     }
     return $link;
 }