| Total Complexity | 5 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class EutilsEsearch implements Resource |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected $url = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi'; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $queryStringParameters = [ |
||
| 18 | 'query' => [ |
||
| 19 | 'db' => 'pubmed', |
||
| 20 | 'version' => '2.0', |
||
| 21 | 'retmode' => 'json', |
||
| 22 | 'term' => '', |
||
| 23 | 'field' => 'AID', |
||
| 24 | ], |
||
| 25 | ]; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * EutilsEsearch constructor. |
||
| 29 | * |
||
| 30 | * @param Identifier $identifier |
||
| 31 | */ |
||
| 32 | public function __construct(Identifier $identifier) |
||
| 33 | { |
||
| 34 | $this->queryStringParameters['query']['term'] = $identifier->getQueryString(); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | public function getApiUrl(): string |
||
| 41 | { |
||
| 42 | return $this->url; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | public function getRequestOptions(): array |
||
| 49 | { |
||
| 50 | return $this->queryStringParameters; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $document |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | public function getDataFrom(string $document): array |
||
| 67 | } |
||
| 68 | } |
||
| 69 | } |
||
| 70 |