mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 03:14:32 +02:00
Fixed code style.
This commit is contained in:
parent
2853e471c4
commit
d0b1024d80
212 changed files with 495 additions and 1005 deletions
|
@ -51,8 +51,6 @@ final class BarcodeContentGenerator
|
|||
|
||||
/**
|
||||
* Generates a fixed URL to the given Element that can be embedded in a 2D code (e.g. QR code).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getURLContent(AbstractDBElement $target): string
|
||||
{
|
||||
|
@ -68,8 +66,6 @@ final class BarcodeContentGenerator
|
|||
/**
|
||||
* Returns a Code that can be used in a 1D barcode.
|
||||
* The return value has a format of "L0123".
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get1DBarcodeContent(AbstractDBElement $target): string
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ final class BarcodeExampleElementsGenerator
|
|||
|
||||
private function getStructuralData(string $class): AbstractStructuralDBElement
|
||||
{
|
||||
if (! is_a($class, AbstractStructuralDBElement::class, true)) {
|
||||
if (!is_a($class, AbstractStructuralDBElement::class, true)) {
|
||||
throw new \InvalidArgumentException('$class must be an child of AbstractStructuralDBElement');
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,6 @@ 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.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function normalizeBarcodeContent(string $input): array
|
||||
{
|
||||
|
@ -55,7 +53,7 @@ final class BarcodeNormalizer
|
|||
$prefix = $matches[1];
|
||||
$id = (int) $matches[2];
|
||||
|
||||
if (! isset(self::PREFIX_TYPE_MAP[$prefix])) {
|
||||
if (!isset(self::PREFIX_TYPE_MAP[$prefix])) {
|
||||
throw new \InvalidArgumentException('Unknown prefix '.$prefix);
|
||||
}
|
||||
|
||||
|
@ -67,7 +65,7 @@ final class BarcodeNormalizer
|
|||
$prefix = $matches[1];
|
||||
$id = (int) $matches[2];
|
||||
|
||||
if (! isset(self::PREFIX_TYPE_MAP[$prefix])) {
|
||||
if (!isset(self::PREFIX_TYPE_MAP[$prefix])) {
|
||||
throw new \InvalidArgumentException('Unknown prefix '.$prefix);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ final class BarcodeRedirector
|
|||
* @param string $type The type of the element that was scanned (e.g. 'part', 'lot', etc.)
|
||||
* @param int $id The ID of the element that was scanned
|
||||
*
|
||||
* @return string The URL to which should be redirected.
|
||||
* @return string the URL to which should be redirected
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
*/
|
||||
|
|
|
@ -48,21 +48,19 @@ final class LabelGenerator
|
|||
|
||||
/**
|
||||
* @param object|object[] $elements An element or an array of elements for which labels should be generated
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateLabel(LabelOptions $options, $elements): string
|
||||
{
|
||||
if (! is_array($elements) && ! is_object($elements)) {
|
||||
if (!is_array($elements) && !is_object($elements)) {
|
||||
throw new \InvalidArgumentException('$element must be an object or an array of objects!');
|
||||
}
|
||||
|
||||
if (! is_array($elements)) {
|
||||
if (!is_array($elements)) {
|
||||
$elements = [$elements];
|
||||
}
|
||||
|
||||
foreach ($elements as $element) {
|
||||
if (! $this->supports($options, $element)) {
|
||||
if (!$this->supports($options, $element)) {
|
||||
throw new \InvalidArgumentException('The given options are not compatible with the given element!');
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +81,7 @@ final class LabelGenerator
|
|||
public function supports(LabelOptions $options, object $element)
|
||||
{
|
||||
$supported_type = $options->getSupportedElement();
|
||||
if (! isset(static::CLASS_SUPPORT_MAPPING[$supported_type])) {
|
||||
if (!isset(static::CLASS_SUPPORT_MAPPING[$supported_type])) {
|
||||
throw new \InvalidArgumentException('Supported type name of the Label options not known!');
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ final class LabelTextReplacer
|
|||
* If the given string is not a placeholder or the placeholder is not known, it will be returned unchanged.
|
||||
*
|
||||
* @param string $placeholder The placeholder that should be replaced. (e.g. '%%PLACEHOLDER%%')
|
||||
* @param object $target The object that should be used for the placeholder info source.
|
||||
* @param object $target the object that should be used for the placeholder info source
|
||||
*
|
||||
* @return string If the placeholder was valid, the replaced info. Otherwise the passed string.
|
||||
*/
|
||||
|
@ -64,9 +64,9 @@ final class LabelTextReplacer
|
|||
* Replaces all placeholders in the input lines.
|
||||
*
|
||||
* @param string $lines The input lines that should be replaced
|
||||
* @param object $target The object that should be used as source for the informations.
|
||||
* @param object $target the object that should be used as source for the informations
|
||||
*
|
||||
* @return string The Lines with replaced informations.
|
||||
* @return string the Lines with replaced informations
|
||||
*/
|
||||
public function replace(string $lines, object $target): string
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ final class PartProvider implements PlaceholderProviderInterface
|
|||
|
||||
public function replace(string $placeholder, object $part, array $options = []): ?string
|
||||
{
|
||||
if (! $part instanceof Part) {
|
||||
if (!$part instanceof Part) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ interface PlaceholderProviderInterface
|
|||
*
|
||||
* @param string $placeholder The placeholder (e.g. "%%PLACEHOLDER%%") that should be replaced
|
||||
* @param object $label_target The object that is targeted by the label
|
||||
* @param array $options A list of options that can be used to specify the generated output further.
|
||||
* @param array $options a list of options that can be used to specify the generated output further
|
||||
*
|
||||
* @return string|null The real value of this placeholder, null if not supported.
|
||||
* @return string|null the real value of this placeholder, null if not supported
|
||||
*/
|
||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue