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