Passed
Pull Request — master (#195)
by
unknown
08:13
created

RorDataService::getOrganisationData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
namespace EWW\Dpf\Services\FeUser;
3
4
use \Httpful\Request;
5
6
class RorDataService
7
{
8
9
    protected $apiUrl = 'https://api.ror.org/organizations';
10
11
    public function __construct() {
12
13
    }
14
15
    public function searchTermReplacement($searchTerm) {
16
        return urlencode($searchTerm);
17
    }
18
19
    public function searchOrganisationRequest($searchTerm) {
20
        $response = Request::get($this->apiUrl . '?query=' . $this->searchTermReplacement($searchTerm))
21
            ->send();
22
23
        return ['entries' => $response->body->items];
24
    }
25
26
    public function getOrganisationData($rorId) {
27
        $response = Request::get($this->apiUrl . '/' . $rorId)
28
            ->send();
29
30
        return $response->body;
31
    }
32
33
}