Fixed coding style.

This commit is contained in:
Jan Böhmer 2020-05-10 21:39:31 +02:00
parent e9493e52ec
commit f5d685dfd4
71 changed files with 619 additions and 531 deletions

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -20,7 +23,6 @@
namespace App\Services\LabelSystem\Barcodes;
final class BarcodeNormalizer
{
private const PREFIX_TYPE_MAP = [
@ -31,8 +33,8 @@ final class BarcodeNormalizer
/**
* Parses barcode content and normalizes it.
* Returns an array in the format ['part', 1]: First entry contains element type, second the ID of the element
* @param string $input
* Returns an array in the format ['part', 1]: First entry contains element type, second the ID of the element.
*
* @return array
*/
public function normalizeBarcodeContent(string $input): array
@ -53,9 +55,10 @@ final class BarcodeNormalizer
$prefix = $matches[1];
$id = (int) $matches[2];
if (!isset(self::PREFIX_TYPE_MAP[$prefix])) {
throw new \InvalidArgumentException('Unknown prefix ' . $prefix);
if (! isset(self::PREFIX_TYPE_MAP[$prefix])) {
throw new \InvalidArgumentException('Unknown prefix '.$prefix);
}
return [self::PREFIX_TYPE_MAP[$prefix], $id];
}
@ -64,9 +67,10 @@ final class BarcodeNormalizer
$prefix = $matches[1];
$id = (int) $matches[2];
if (!isset(self::PREFIX_TYPE_MAP[$prefix])) {
throw new \InvalidArgumentException('Unknown prefix ' . $prefix);
if (! isset(self::PREFIX_TYPE_MAP[$prefix])) {
throw new \InvalidArgumentException('Unknown prefix '.$prefix);
}
return [self::PREFIX_TYPE_MAP[$prefix], $id];
}
@ -80,7 +84,6 @@ final class BarcodeNormalizer
return ['part', (int) $matches[1]];
}
throw new \InvalidArgumentException('Unknown barcode format!');
}
}
}