| 1: | <?php |
| 2: | |
| 3: | namespace Scopus\Response; |
| 4: | |
| 5: | class AbstractCoredata |
| 6: | { |
| 7: | |
| 8: | protected $data; |
| 9: | |
| 10: | public function __construct(array $data) |
| 11: | { |
| 12: | $this->data = $data; |
| 13: | } |
| 14: | |
| 15: | public function getUrl() |
| 16: | { |
| 17: | return $this->data['prism:url']; |
| 18: | } |
| 19: | |
| 20: | public function getIdentifier() |
| 21: | { |
| 22: | return isset($this->data['dc:identifier']) ? $this->data['dc:identifier'] : null; |
| 23: | } |
| 24: | |
| 25: | public function getScopusId() |
| 26: | { |
| 27: | $identifier = $this->getIdentifier(); |
| 28: | if (substr($identifier, 0, 10) === 'SCOPUS_ID:') { |
| 29: | return explode(':', $identifier, 2)[1]; |
| 30: | } |
| 31: | } |
| 32: | |
| 33: | public function getEid() |
| 34: | { |
| 35: | return isset($this->data['eid']) ? $this->data['eid'] : null; |
| 36: | } |
| 37: | |
| 38: | public function getTitle() |
| 39: | { |
| 40: | return isset($this->data['dc:title']) ? $this->data['dc:title'] : null; |
| 41: | } |
| 42: | |
| 43: | public function getPublicationName() |
| 44: | { |
| 45: | return isset($this->data['prism:publicationName']) ? $this->data['prism:publicationName'] : null; |
| 46: | } |
| 47: | |
| 48: | public function getEIssn() |
| 49: | { |
| 50: | return $this->data['prism:eIssn']; |
| 51: | } |
| 52: | |
| 53: | public function getVolume() |
| 54: | { |
| 55: | return $this->data['prism:volume']; |
| 56: | } |
| 57: | |
| 58: | public function getPageRange() |
| 59: | { |
| 60: | return isset($this->data['prism:pageRange']) ? $this->data['prism:pageRange'] : null; |
| 61: | } |
| 62: | |
| 63: | public function getCoverDate() |
| 64: | { |
| 65: | return isset($this->data['prism:coverDate']) ? $this->data['prism:coverDate'] : null;; |
| 66: | } |
| 67: | |
| 68: | public function getDoi() |
| 69: | { |
| 70: | return isset($this->data['prism:doi']) ? $this->data['prism:doi'] : null; |
| 71: | } |
| 72: | |
| 73: | public function getPubmedId() |
| 74: | { |
| 75: | return isset($this->data['pubmed-id']) ? $this->data['pubmed-id'] : null; |
| 76: | } |
| 77: | |
| 78: | public function getArticleNumber() |
| 79: | { |
| 80: | return isset($this->data['article-number']) ? $this->data['article-number'] : null; |
| 81: | } |
| 82: | |
| 83: | public function getDescription() |
| 84: | { |
| 85: | return $this->data['dc:description']; |
| 86: | } |
| 87: | |
| 88: | public function getCitedbyCount() |
| 89: | { |
| 90: | if (!isset($this->data['citedby-count'])) return 0; |
| 91: | return is_array($this->data['citedby-count']) ? $this->data['citedby-count'][1]['$'] : $this->data['citedby-count']; |
| 92: | } |
| 93: | |
| 94: | public function getAggregationType() |
| 95: | { |
| 96: | return $this->data['prism:aggregationType']; |
| 97: | } |
| 98: | |
| 99: | public function getFundSponsor() |
| 100: | { |
| 101: | return isset($this->data['fund-sponsor']) ? $this->data['fund-sponsor'] : null; |
| 102: | } |
| 103: | |
| 104: | public function getStartPage() |
| 105: | { |
| 106: | $pageRange = $this->getPageRange(); |
| 107: | if ($pageRange) { |
| 108: | return explode('-', $pageRange)[0]; |
| 109: | } |
| 110: | } |
| 111: | |
| 112: | public function getEndPage() |
| 113: | { |
| 114: | $pageRange = $this->getPageRange(); |
| 115: | if ($pageRange) { |
| 116: | $startEndPage = explode('-', $pageRange); |
| 117: | if (count($startEndPage) > 1) { |
| 118: | return $startEndPage[1]; |
| 119: | } |
| 120: | } |
| 121: | } |
| 122: | |
| 123: | public function getIssn() |
| 124: | { |
| 125: | return $this->data['prism:issn']; |
| 126: | } |
| 127: | |
| 128: | public function hasError() |
| 129: | { |
| 130: | return isset($this->data['error']) ? $this->data['error'] : false; |
| 131: | } |
| 132: | } |
| 133: | |