| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function getItems( $limit = 'max' ) { |
||
| 34 | $api = MediawikiApi::newFromApiEndpoint( 'https://www.wikidata.org/w/api.php' ); |
||
| 35 | $req = FluentRequest::factory() |
||
| 36 | ->setAction( 'wbsearchentities' ) |
||
| 37 | ->addParams( [ |
||
| 38 | 'search' => $this->searchTerm, |
||
| 39 | 'type' => 'item', |
||
| 40 | 'limit' => $limit, |
||
| 41 | 'language' => 'en', |
||
| 42 | ] ); |
||
| 43 | $results = []; |
||
| 44 | $response = $api->getRequest( $req ); |
||
| 45 | foreach ( $response['search'] as $info ) { |
||
| 46 | $item = Item::factory( $info['id'], $this->lang, $this->cache ); |
||
| 47 | $results[] = $item; |
||
| 48 | } |
||
| 49 | return $results; |
||
| 50 | } |
||
| 52 |