@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * Get Site details |
| 19 | 19 | * @return mixed |
| 20 | 20 | */ |
| 21 | - function details(){ |
|
| 21 | + function details() { |
|
| 22 | 22 | $request = $this->connector->getFromSite('details'); |
| 23 | 23 | |
| 24 | 24 | $details = collect(); |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | * Get Site energy |
| 46 | 46 | * @return mixed |
| 47 | 47 | */ |
| 48 | - function energy($subtractDays, $order){ |
|
| 48 | + function energy($subtractDays, $order) { |
|
| 49 | 49 | $start = Carbon::now()->subDays($subtractDays-1)->format('Y-m-d'); |
| 50 | 50 | $end = Carbon::now()->format('Y-m-d'); |
| 51 | - $request = $this->connector->getFromSiteWithStartAndEnd('energy','QUARTER_OF_AN_HOUR', $start, $end); |
|
| 51 | + $request = $this->connector->getFromSiteWithStartAndEnd('energy', 'QUARTER_OF_AN_HOUR', $start, $end); |
|
| 52 | 52 | |
| 53 | 53 | $energy = collect(); |
| 54 | 54 | |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | * Get Site power |
| 72 | 72 | * @return mixed |
| 73 | 73 | */ |
| 74 | - function power($subtractDays, $order){ |
|
| 74 | + function power($subtractDays, $order) { |
|
| 75 | 75 | $start = Carbon::now()->subDays($subtractDays-1)->format('Y-m-d%20H:i:s'); |
| 76 | 76 | $end = Carbon::now()->format('Y-m-d%20H:i:s'); |
| 77 | - $request = $this->connector->getFromSiteWithStartAndEnd('power','DAY', $start, $end,true); |
|
| 77 | + $request = $this->connector->getFromSiteWithStartAndEnd('power', 'DAY', $start, $end, true); |
|
| 78 | 78 | |
| 79 | 79 | $power = collect(); |
| 80 | 80 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * Get Site overview |
| 98 | 98 | * @return mixed |
| 99 | 99 | */ |
| 100 | - function overview(){ |
|
| 100 | + function overview() { |
|
| 101 | 101 | $request = $this->connector->getFromSite('overview'); |
| 102 | 102 | |
| 103 | 103 | $overview = collect(); |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | public function __construct() |
| 17 | 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/'); |
|
| 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 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param $siteProperty |
| 29 | 29 | * @return mixed |
| 30 | 30 | */ |
| 31 | - function getFromSite($siteProperty){ |
|
| 31 | + function getFromSite($siteProperty) { |
|
| 32 | 32 | $request = Curl::to($this->endpoint . 'site/' . $this->id . '/' . $siteProperty . $this->key)->asJson()->get()->{$siteProperty}; |
| 33 | 33 | return $request; |
| 34 | 34 | } |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * @param $siteProperty |
| 46 | 46 | * @return mixed |
| 47 | 47 | */ |
| 48 | - function getFromSiteWithStartAndEnd($siteProperty,$timeUnit,$startDate,$endDate,$withTime = false){ |
|
| 49 | - if(!$withTime) { |
|
| 48 | + function getFromSiteWithStartAndEnd($siteProperty, $timeUnit, $startDate, $endDate, $withTime = false) { |
|
| 49 | + if (!$withTime) { |
|
| 50 | 50 | $request = |
| 51 | 51 | Curl::to($this->endpoint . 'site/' . $this->id . '/' . $siteProperty . |
| 52 | 52 | $this->key . |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | '&endDate=' . $endDate . |
| 55 | 55 | '&timeUnit=' . $timeUnit |
| 56 | 56 | )->asJson()->get()->{$siteProperty}; |
| 57 | - } |
|
| 58 | - else { |
|
| 57 | + } else { |
|
| 59 | 58 | $request = |
| 60 | 59 | Curl::to($this->endpoint . 'site/' . $this->id . '/' . $siteProperty . |
| 61 | 60 | $this->key . |
@@ -33,5 +33,5 @@ |
||
| 33 | 33 | * @param $siteProperty |
| 34 | 34 | * @return mixed |
| 35 | 35 | */ |
| 36 | - public function getFromSiteWithStartAndEnd($siteProperty,$timeUnit,$startDate,$endDate,$withTime = false); |
|
| 36 | + public function getFromSiteWithStartAndEnd($siteProperty, $timeUnit, $startDate, $endDate, $withTime = false); |
|
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |