Total Complexity | 4 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class SolarEdgeClient implements ApiConnectorInterface |
||
15 | { |
||
16 | public function __construct() |
||
17 | { |
||
18 | $this->key = '?api_key=' . env('SOLAREDGE_API_KEY',''); |
||
|
|||
19 | $this->id = env('SOLAREDGE_INSTALLATION_ID',''); |
||
20 | $this->endpoint = env('SOLAREDGE_ENDPOINT','https://monitoringapi.solaredge.com/'); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Get from Site |
||
25 | * - endpoint |
||
26 | * - id |
||
27 | * - key |
||
28 | * @param $siteProperty |
||
29 | * @return mixed |
||
30 | */ |
||
31 | function getFromSite($siteProperty){ |
||
32 | $request = Curl::to($this->endpoint . 'site/' . $this->id . '/' . $siteProperty . $this->key)->asJson()->get()->{$siteProperty}; |
||
33 | return $request; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Get from Site with start- and end date |
||
38 | * - endpoint |
||
39 | * - id |
||
40 | * - key |
||
41 | * - timeUnit |
||
42 | * - startDate |
||
43 | * - endDate |
||
44 | * - withTime |
||
45 | * @param $siteProperty |
||
46 | * @return mixed |
||
47 | */ |
||
48 | function getFromSiteWithStartAndEnd($siteProperty,$timeUnit,$startDate,$endDate,$withTime = false){ |
||
68 | } |
||
69 | } |