26 lines
575 B
PHP
26 lines
575 B
PHP
<?php
|
|
|
|
namespace App\Features\History\Services;
|
|
|
|
use App\Contracts\PriceRepository;
|
|
use App\Features\History\Data\HistoryData;
|
|
use Carbon\Carbon;
|
|
|
|
class HistoryService
|
|
{
|
|
public function __construct(
|
|
public PriceRepository $repository
|
|
) {}
|
|
|
|
public function getHistoryData(Carbon $date): HistoryData
|
|
{
|
|
$electricity = $this->repository->retrieveElectricityForDate($date);
|
|
$gas = $this->repository->retrieveGasForDate($date);
|
|
|
|
return new HistoryData(
|
|
electricity: $electricity,
|
|
gas: $gas
|
|
);
|
|
}
|
|
}
|