Skip to content

Commit

Permalink
Stage TODO comments
Browse files Browse the repository at this point in the history
(mainly for transparency)
  • Loading branch information
jyevon committed May 17, 2024
1 parent e9e3647 commit 1de2dfb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Services/InfoProviderSystem/Providers/PollinProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function productAndHtmlToDTO(Schema\Product $product,

$parameters = [];
$footprint = null;
foreach($speclines as $line) {
foreach($speclines as $line) {//TODO test with https://www.pollin.de/p/spannungsregler-bausatz-810029 ; ... and decimal , seemed to be a problem there ...
$name = '';

// Parse property name
Expand All @@ -137,6 +137,7 @@ private function productAndHtmlToDTO(Schema\Product $product,
}

// Parse known number formats
// TODO use use parseValueField or parseValueIncludingUnit within ParameterDTO?
$min = null;
$typ = null;
$max = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function __construct(HttpClientInterface $httpClient,
private readonly bool $net_prices, private readonly bool $add_gtin_to_orderno)
{
parent::__construct($httpClient, $enable, null, $add_gtin_to_orderno);
// TODO map ISO country codes to Reichelt's codes using php match syntax? https://www.php.net/manual/en/control-structures.match.php
}

public function getProviderInfo(): array
Expand Down Expand Up @@ -132,6 +133,7 @@ private function productAndHtmlToDTO(Schema\Product $product,
} // Factory number & Package weight have no 'name' but would be useful ...

// Parse known number formats
// TODO use use parseValueField or parseValueIncludingUnit within ParameterDTO?
$min = null;
$typ = null;
$max = null;
Expand Down Expand Up @@ -253,6 +255,8 @@ private function productAndHtmlToDTO(Schema\Product $product,

$link = $node->firstChild;
$href = $link->attributes->getNamedItem('href')->textContent;
// TODO links now take an extra redirect step that messes up Part-DB's file name and type regongnition, e.g. https://www.reichelt.de/index.html?ACTION=7&LA=3&OPEN=0&INDEX=0&FILENAME=A100%2FAOD409_SPEC.pdf
// => follow link to retrieve redirection end URL?
if($href === null) continue;

$datasheetDTOs[] = new FileDTO(self::BASE_URL . $href, $link->textContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ protected function productToDTO(Schema\Product $product,
if($product->weight instanceof Schema\QuantitativeValue) { // not tested!
$tmp = $product->weight->value->getFirstNonEmptyStringValue();
if(is_numeric($tmp)) {
// TODO use match syntax instead? https://www.php.net/manual/en/control-structures.match.php
switch ($product->weight->unitCode->getFirstNonEmptyStringValue()) {
// units as in http://www.unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_Rev9e_2014.xls
case 'KGM': // kg
Expand Down Expand Up @@ -347,6 +348,7 @@ protected function productToDTO(Schema\Product $product,
//Parse images
$images = [];
foreach($product->image as $image) {
// TODO parse https://schema.org/ImageObject for https://www.hornbach.de/p/brennenstuhl-steckdosenadapter-mit-ueberspannungsschutz-adapter-als-blitzschutz-fuer-elektrogeraete-anthrazit/10109651/
if(empty($image)) continue;

$images[] = new FileDTO((string) $image);
Expand Down

0 comments on commit 1de2dfb

Please sign in to comment.