mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-11 03:59:35 +00:00
Fixed phpstan issues in GenericWebProvider
This commit is contained in:
parent
851055bdb4
commit
061af28c48
2 changed files with 6 additions and 6 deletions
|
|
@ -67,3 +67,6 @@ parameters:
|
|||
-
|
||||
message: '#Should not use function "shell_exec"#'
|
||||
path: src/Services/System/UpdateExecutor.php
|
||||
|
||||
- message: '#Access to an undefined property Brick\\Schema\\Interfaces\\#'
|
||||
path: src/Services/InfoProviderSystem/Providers/GenericWebProvider.php
|
||||
|
|
|
|||
|
|
@ -213,14 +213,14 @@ class GenericWebProvider implements InfoProviderInterface
|
|||
|
||||
//Try to extract weight
|
||||
$mass = null;
|
||||
if (($weight = $product?->weight->getFirstValue()) instanceof QuantitativeValue) {
|
||||
if (($weight = $product->weight?->getFirstValue()) instanceof QuantitativeValue) {
|
||||
$mass = $weight->value->toString();
|
||||
}
|
||||
|
||||
return new PartDetailDTO(
|
||||
provider_key: $this->getProviderKey(),
|
||||
provider_id: $url,
|
||||
name: $product->name?->toString() ?? $product->alternateName?->toString() ?? $product?->mpn->toString() ?? 'Unknown Name',
|
||||
name: $product->name?->toString() ?? $product->alternateName?->toString() ?? $product->mpn?->toString() ?? 'Unknown Name',
|
||||
description: $this->getMetaContent($dom, 'og:description') ?? $this->getMetaContent($dom, 'description') ?? '',
|
||||
category: $this->breadcrumbToCategory($categoryBreadcrumb) ?? $product->category?->toString(),
|
||||
manufacturer: self::propertyOrString($product->manufacturer) ?? self::propertyOrString($product->brand),
|
||||
|
|
@ -247,10 +247,7 @@ class GenericWebProvider implements InfoProviderInterface
|
|||
return $value;
|
||||
}
|
||||
|
||||
if ($value instanceof Thing) {
|
||||
return $value->$property?->toString();
|
||||
}
|
||||
return null;
|
||||
return $value->$property?->toString();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue