Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
5 / 5 |
DummyDataSource | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
5 / 5 |
__construct | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
|||
getQuotes | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
declare(strict_types=1); | |
namespace App\Quote\DataSource; | |
use App\Quote\Collection\QuoteCollection; | |
use App\Quote\Collection\QuoteCollectionInterface; | |
final class DummyDataSource implements DataSourceInterface | |
{ | |
private QuoteCollectionInterface $quotes; | |
public function __construct(array $data = []) | |
{ | |
if (empty($data)) { | |
$data = [ | |
[ | |
'author' => 'Dreamer', | |
'quote' => 'Everything is possible' | |
], | |
[ | |
'author' => 'AI', | |
'quote' => 'ETL: Extract, Transform and Load' | |
] | |
]; | |
} | |
$this->quotes = QuoteCollection::fromArray($data); | |
} | |
public function getQuotes(): QuoteCollectionInterface | |
{ | |
return $this->quotes; | |
} | |
} |