Minor code cleanup
This commit is contained in:
19
bin/app.php
19
bin/app.php
@@ -2,7 +2,7 @@
|
||||
|
||||
use Domain\Model\ASRockMemoryQVL;
|
||||
use Domain\Model\MemoryConfiguration;
|
||||
use Domain\Normalizer\Decorator\PricewatchDecorator;
|
||||
use Domain\Normalizer\Decorator\TweakersPricewatchUrl;
|
||||
use Domain\Normalizer\MemoryConfigurationNormalizer;
|
||||
use Encoder\EncoderFactory;
|
||||
use IO\Downloader;
|
||||
@@ -10,22 +10,25 @@ use IO\Downloader;
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// setup
|
||||
$list = new ASRockMemoryQVL('AMD', 'X570 Pro4', cpuFamily: 'MS');
|
||||
$qualifiedVendorList = new ASRockMemoryQVL('AMD', 'X570 Pro4', cpuFamily: 'MS');
|
||||
$downloader = new Downloader();
|
||||
$scraper = new MemoryQVLScraper();
|
||||
|
||||
// scrape and filter
|
||||
$page = $downloader->download($list);
|
||||
$page = $downloader->download($qualifiedVendorList);
|
||||
$configurations = $scraper->scrape($page);
|
||||
$selection = $configurations->filter(fn(MemoryConfiguration $memory) => in_array($memory->numberOfModules, [2, 4])
|
||||
$selection = $configurations->filter(static function (MemoryConfiguration $memory) {
|
||||
in_array($memory->numberOfModules, [2, 4])
|
||||
&& $memory->totalSize >= 16
|
||||
&& $memory->speed >= 3600
|
||||
&& $memory->overclockingVerified
|
||||
);
|
||||
&& $memory->overclockingVerified;
|
||||
});
|
||||
|
||||
// data presentation
|
||||
$normalizer = new MemoryConfigurationNormalizer();
|
||||
$normalizer = PricewatchDecorator::decorate($normalizer);
|
||||
$normalizer = TweakersPricewatchUrl::decorate($normalizer);
|
||||
$encoderFactory = new EncoderFactory($normalizer);
|
||||
$encoder = $encoderFactory->getEncoder($argv[1] ?? 'csv');
|
||||
|
||||
$encoding = $argv[1] ?? 'csv';
|
||||
$encoder = $encoderFactory->getEncoder($encoding);
|
||||
print($encoder->encode($selection));
|
||||
|
||||
Reference in New Issue
Block a user