mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-21 18:39:31 +00:00
Applied rector suggestions
This commit is contained in:
parent
4106bcef5f
commit
20f32c7f12
170 changed files with 808 additions and 761 deletions
|
|
@ -26,6 +26,7 @@ namespace App\Services\InfoProviderSystem\DTOs;
|
|||
/**
|
||||
* This DTO represents a parameter of a part (similar to the AbstractParameter entity).
|
||||
* This could be a voltage, a current, a temperature or similar.
|
||||
* @see \App\Tests\Services\InfoProviderSystem\DTOs\ParameterDTOTest
|
||||
*/
|
||||
class ParameterDTO
|
||||
{
|
||||
|
|
@ -76,7 +77,7 @@ class ParameterDTO
|
|||
$parts = preg_split('/\s*(\.{3}|~)\s*/', $value);
|
||||
if (count($parts) === 2) {
|
||||
//Try to extract number and unit from value (allow leading +)
|
||||
if (empty($unit)) {
|
||||
if ($unit === null || trim($unit) === '') {
|
||||
[$number, $unit] = self::splitIntoValueAndUnit(ltrim($parts[0], " +")) ?? [$parts[0], null];
|
||||
} else {
|
||||
$number = $parts[0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue