mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 19:58:53 +02:00
Applied rector suggestions
This commit is contained in:
parent
4106bcef5f
commit
20f32c7f12
170 changed files with 808 additions and 761 deletions
|
@ -28,6 +28,7 @@ use Com\Tecnick\Barcode\Barcode;
|
|||
|
||||
/**
|
||||
* This function is used to generate barcodes of various types using arbitrary (text) content.
|
||||
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeHelperTest
|
||||
*/
|
||||
class BarcodeHelper
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ class BarcodeHelper
|
|||
{
|
||||
$svg = $this->barcodeAsSVG($content, $type);
|
||||
$base64 = $this->dataUri($svg, 'image/svg+xml');
|
||||
$alt_text = $alt_text ?? $content;
|
||||
$alt_text ??= $content;
|
||||
|
||||
return '<img src="'.$base64.'" width="'.$width.'" style="min-height: 25px;" alt="'.$alt_text.'"/>';
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeNormalizerTest
|
||||
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeScanHelperTest
|
||||
*/
|
||||
final class BarcodeScanHelper
|
||||
{
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -17,7 +20,6 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Services\LabelSystem;
|
||||
|
||||
use Dompdf\Dompdf;
|
||||
|
@ -36,10 +38,8 @@ class DompdfFactory implements DompdfFactoryInterface
|
|||
|
||||
private function createDirectoryIfNotExisting(string $path): void
|
||||
{
|
||||
if (!is_dir($path)) {
|
||||
if (!mkdir($concurrentDirectory = $path, 0777, true) && !is_dir($concurrentDirectory)) {
|
||||
throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
|
||||
}
|
||||
if (!is_dir($path) && (!mkdir($concurrentDirectory = $path, 0777, true) && !is_dir($concurrentDirectory))) {
|
||||
throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,4 +51,4 @@ class DompdfFactory implements DompdfFactoryInterface
|
|||
'tempDir' => $this->tmpDirectory,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ use App\Services\LabelSystem\Barcodes\BarcodeHelper;
|
|||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\BarcodeGeneratorTest
|
||||
* @see \App\Tests\Services\LabelSystem\LabelBarcodeGeneratorTest
|
||||
*/
|
||||
final class LabelBarcodeGenerator
|
||||
{
|
||||
|
|
|
@ -119,7 +119,7 @@ final class PartProvider implements PlaceholderProviderInterface
|
|||
}
|
||||
|
||||
if ('[[DESCRIPTION_T]]' === $placeholder) {
|
||||
return strip_tags($parsedown->line($part->getDescription()));
|
||||
return strip_tags((string) $parsedown->line($part->getDescription()));
|
||||
}
|
||||
|
||||
if ('[[COMMENT]]' === $placeholder) {
|
||||
|
@ -127,7 +127,7 @@ final class PartProvider implements PlaceholderProviderInterface
|
|||
}
|
||||
|
||||
if ('[[COMMENT_T]]' === $placeholder) {
|
||||
return strip_tags($parsedown->line($part->getComment()));
|
||||
return strip_tags((string) $parsedown->line($part->getComment()));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -52,7 +52,7 @@ final class StructuralDBElementProvider implements PlaceholderProviderInterface
|
|||
return $label_target->getComment();
|
||||
}
|
||||
if ('[[COMMENT_T]]' === $placeholder) {
|
||||
return strip_tags($label_target->getComment());
|
||||
return strip_tags((string) $label_target->getComment());
|
||||
}
|
||||
if ('[[FULL_PATH]]' === $placeholder) {
|
||||
return $label_target->getFullPath();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue