mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-12 18:29:37 +00:00
Fixed coding style.
This commit is contained in:
parent
e9493e52ec
commit
f5d685dfd4
71 changed files with 619 additions and 531 deletions
|
|
@ -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,33 +23,30 @@
|
|||
|
||||
namespace App\Services\LabelSystem\PlaceholderProviders;
|
||||
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
|
||||
final class StructuralDBElementProvider implements PlaceholderProviderInterface
|
||||
{
|
||||
|
||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
||||
{
|
||||
if ($label_target instanceof AbstractStructuralDBElement) {
|
||||
if ($placeholder === '[[COMMENT]]') {
|
||||
if ('[[COMMENT]]' === $placeholder) {
|
||||
return $label_target->getComment();
|
||||
}
|
||||
if ($placeholder === '[[COMMENT_T]]') {
|
||||
if ('[[COMMENT_T]]' === $placeholder) {
|
||||
return strip_tags($label_target->getComment());
|
||||
}
|
||||
if ($placeholder === '[[FULL_PATH]]') {
|
||||
if ('[[FULL_PATH]]' === $placeholder) {
|
||||
return $label_target->getFullPath();
|
||||
}
|
||||
if ($placeholder === '[[PARENT]]') {
|
||||
if ('[[PARENT]]' === $placeholder) {
|
||||
return $label_target->getParent() ? $label_target->getParent()->getName() : '';
|
||||
}
|
||||
if ($placeholder === '[[PARENT_FULL_PATH]]') {
|
||||
if ('[[PARENT_FULL_PATH]]' === $placeholder) {
|
||||
return $label_target->getParent() ? $label_target->getParent()->getFullPath() : '';
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue