mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Improved code style of tests
This commit is contained in:
parent
5629215ce4
commit
684334ba22
73 changed files with 196 additions and 38 deletions
|
@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||||
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
||||||
use Rector\Config\RectorConfig;
|
use Rector\Config\RectorConfig;
|
||||||
use Rector\Doctrine\Set\DoctrineSetList;
|
use Rector\Doctrine\Set\DoctrineSetList;
|
||||||
|
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
|
||||||
|
use Rector\PHPUnit\Set\PHPUnitSetList;
|
||||||
use Rector\Set\ValueObject\LevelSetList;
|
use Rector\Set\ValueObject\LevelSetList;
|
||||||
use Rector\Set\ValueObject\SetList;
|
use Rector\Set\ValueObject\SetList;
|
||||||
use Rector\Symfony\Set\SymfonyLevelSetList;
|
use Rector\Symfony\Set\SymfonyLevelSetList;
|
||||||
|
@ -42,5 +44,10 @@ return static function (RectorConfig $rectorConfig): void {
|
||||||
//Doctrine rules
|
//Doctrine rules
|
||||||
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
|
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
|
||||||
DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
||||||
|
|
||||||
|
//PHPUnit rules
|
||||||
|
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
|
||||||
|
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
|
||||||
|
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\AttachmentTypeControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/attachment_type')]
|
#[Route(path: '/attachment_type')]
|
||||||
class AttachmentTypeController extends BaseAdminController
|
class AttachmentTypeController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\CategoryControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/category')]
|
#[Route(path: '/category')]
|
||||||
class CategoryController extends BaseAdminController
|
class CategoryController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\FootprintControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/footprint')]
|
#[Route(path: '/footprint')]
|
||||||
class FootprintController extends BaseAdminController
|
class FootprintController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\LabelProfileControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/label_profile')]
|
#[Route(path: '/label_profile')]
|
||||||
class LabelProfileController extends BaseAdminController
|
class LabelProfileController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\ManufacturerControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/manufacturer')]
|
#[Route(path: '/manufacturer')]
|
||||||
class ManufacturerController extends BaseAdminController
|
class ManufacturerController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\MeasurementUnitControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/measurement_unit')]
|
#[Route(path: '/measurement_unit')]
|
||||||
class MeasurementUnitController extends BaseAdminController
|
class MeasurementUnitController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\StorelocationControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/store_location')]
|
#[Route(path: '/store_location')]
|
||||||
class StorelocationController extends BaseAdminController
|
class StorelocationController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\AdminPages\SupplierControllerTest
|
||||||
|
*/
|
||||||
#[Route(path: '/supplier')]
|
#[Route(path: '/supplier')]
|
||||||
class SupplierController extends BaseAdminController
|
class SupplierController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,7 @@ class PartListsController extends AbstractController
|
||||||
$attrs['disabled'] = $disabled;
|
$attrs['disabled'] = $disabled;
|
||||||
|
|
||||||
$parent = $form->getParent();
|
$parent = $form->getParent();
|
||||||
if (!$parent instanceof \Symfony\Component\Form\FormInterface) {
|
if (!$parent instanceof FormInterface) {
|
||||||
throw new \RuntimeException('This function can only be used on form fields that are children of another form!');
|
throw new \RuntimeException('This function can only be used on form fields that are children of another form!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Controller\RedirectControllerTest
|
||||||
|
*/
|
||||||
class RedirectController extends AbstractController
|
class RedirectController extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(protected string $default_locale, protected TranslatorInterface $translator, protected bool $enforce_index_php)
|
public function __construct(protected string $default_locale, protected TranslatorInterface $translator, protected bool $enforce_index_php)
|
||||||
|
@ -55,7 +58,7 @@ class RedirectController extends AbstractController
|
||||||
|
|
||||||
//If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string
|
//If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string
|
||||||
if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable())
|
if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable())
|
||||||
&& !str_contains($new_url, 'index.php')) {
|
&& !str_contains((string) $new_url, 'index.php')) {
|
||||||
//Like Request::getUriForPath only with index.php
|
//Like Request::getUriForPath only with index.php
|
||||||
$new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo();
|
$new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ use LogicException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Attachment.
|
* Class Attachment.
|
||||||
|
* @see \App\Tests\Entity\Attachments\AttachmentTest
|
||||||
*/
|
*/
|
||||||
#[ORM\Entity(repositoryClass: AttachmentRepository::class)]
|
#[ORM\Entity(repositoryClass: AttachmentRepository::class)]
|
||||||
#[ORM\InheritanceType('SINGLE_TABLE')]
|
#[ORM\InheritanceType('SINGLE_TABLE')]
|
||||||
|
|
|
@ -34,6 +34,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AttachmentType.
|
* Class AttachmentType.
|
||||||
|
* @see \App\Tests\Entity\Attachments\AttachmentTypeTest
|
||||||
*/
|
*/
|
||||||
#[ORM\Entity(repositoryClass: StructuralDBElementRepository::class)]
|
#[ORM\Entity(repositoryClass: StructuralDBElementRepository::class)]
|
||||||
#[ORM\Table(name: '`attachment_types`')]
|
#[ORM\Table(name: '`attachment_types`')]
|
||||||
|
|
|
@ -47,6 +47,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
* an attribute of a root element, you will get an exception!
|
* an attribute of a root element, you will get an exception!
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* @see \App\Tests\Entity\Base\AbstractStructuralDBElementTest
|
||||||
*/
|
*/
|
||||||
#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')]
|
#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')]
|
||||||
#[ORM\MappedSuperclass(repositoryClass: StructuralDBElementRepository::class)]
|
#[ORM\MappedSuperclass(repositoryClass: StructuralDBElementRepository::class)]
|
||||||
|
|
|
@ -51,6 +51,7 @@ use App\Repository\LogEntryRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This entity describes an entry in the event log.
|
* This entity describes an entry in the event log.
|
||||||
|
* @see \App\Tests\Entity\LogSystem\AbstractLogEntryTest
|
||||||
*/
|
*/
|
||||||
#[ORM\Entity(repositoryClass: LogEntryRepository::class)]
|
#[ORM\Entity(repositoryClass: LogEntryRepository::class)]
|
||||||
#[ORM\Table('log')]
|
#[ORM\Table('log')]
|
||||||
|
|
|
@ -47,6 +47,9 @@ use App\Entity\Parts\Part;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Entity\Parameters\PartParameterTest
|
||||||
|
*/
|
||||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||||
class PartParameter extends AbstractParameter
|
class PartParameter extends AbstractParameter
|
||||||
|
|
|
@ -49,6 +49,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
*
|
*
|
||||||
* The class properties are split over various traits in directory PartTraits.
|
* The class properties are split over various traits in directory PartTraits.
|
||||||
* Otherwise, this class would be too big, to be maintained.
|
* Otherwise, this class would be too big, to be maintained.
|
||||||
|
* @see \App\Tests\Entity\Parts\PartTest
|
||||||
*/
|
*/
|
||||||
#[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')]
|
#[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')]
|
||||||
#[ORM\Entity(repositoryClass: PartRepository::class)]
|
#[ORM\Entity(repositoryClass: PartRepository::class)]
|
||||||
|
|
|
@ -42,6 +42,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
* It is the connection between a part and its store locations.
|
* It is the connection between a part and its store locations.
|
||||||
*
|
*
|
||||||
* @ValidPartLot()
|
* @ValidPartLot()
|
||||||
|
* @see \App\Tests\Entity\Parts\PartLotTest
|
||||||
*/
|
*/
|
||||||
#[ORM\Entity]
|
#[ORM\Entity]
|
||||||
#[ORM\HasLifecycleCallbacks]
|
#[ORM\HasLifecycleCallbacks]
|
||||||
|
|
|
@ -26,6 +26,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
/**
|
/**
|
||||||
* This class is used to store the permissions of a user.
|
* This class is used to store the permissions of a user.
|
||||||
* This has to be an embeddable or otherwise doctrine could not track the changes of the underlying data array (which is serialized to JSON in the database)
|
* This has to be an embeddable or otherwise doctrine could not track the changes of the underlying data array (which is serialized to JSON in the database)
|
||||||
|
* @see \App\Tests\Entity\UserSystem\PermissionDataTest
|
||||||
*/
|
*/
|
||||||
#[ORM\Embeddable]
|
#[ORM\Embeddable]
|
||||||
final class PermissionData implements \JsonSerializable
|
final class PermissionData implements \JsonSerializable
|
||||||
|
|
|
@ -57,6 +57,7 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
||||||
/**
|
/**
|
||||||
* This entity represents a user, which can log in and have permissions.
|
* This entity represents a user, which can log in and have permissions.
|
||||||
* Also, this entity is able to save some information about the user, like the names, email-address and other info.
|
* Also, this entity is able to save some information about the user, like the names, email-address and other info.
|
||||||
|
* @see \App\Tests\Entity\UserSystem\UserTest
|
||||||
*/
|
*/
|
||||||
#[UniqueEntity('name', message: 'validator.user.username_already_used')]
|
#[UniqueEntity('name', message: 'validator.user.username_already_used')]
|
||||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||||
|
|
|
@ -25,6 +25,9 @@ namespace App\Helpers;
|
||||||
use League\HTMLToMarkdown\HtmlConverter;
|
use League\HTMLToMarkdown\HtmlConverter;
|
||||||
use s9e\TextFormatter\Bundles\Forum as TextFormatter;
|
use s9e\TextFormatter\Bundles\Forum as TextFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Helpers\BBCodeToMarkdownConverterTest
|
||||||
|
*/
|
||||||
class BBCodeToMarkdownConverter
|
class BBCodeToMarkdownConverter
|
||||||
{
|
{
|
||||||
protected HtmlConverter $html_to_markdown;
|
protected HtmlConverter $html_to_markdown;
|
||||||
|
|
|
@ -28,6 +28,7 @@ use App\Validator\Constraints\ProjectSystem\ValidProjectBuildRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ValidProjectBuildRequest()
|
* @ValidProjectBuildRequest()
|
||||||
|
* @see \App\Tests\Helpers\Projects\ProjectBuildRequestTest
|
||||||
*/
|
*/
|
||||||
final class ProjectBuildRequest
|
final class ProjectBuildRequest
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,9 @@ use App\Entity\Base\AbstractNamedDBElement;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Helpers\Trees\TreeViewNode;
|
use App\Helpers\Trees\TreeViewNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Repository\NamedDBElementRepositoryTest
|
||||||
|
*/
|
||||||
class NamedDBElementRepository extends DBElementRepository
|
class NamedDBElementRepository extends DBElementRepository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,9 @@ use App\Helpers\Trees\StructuralDBElementIterator;
|
||||||
use App\Helpers\Trees\TreeViewNode;
|
use App\Helpers\Trees\TreeViewNode;
|
||||||
use RecursiveIteratorIterator;
|
use RecursiveIteratorIterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Repository\StructuralDBElementRepositoryTest
|
||||||
|
*/
|
||||||
class StructuralDBElementRepository extends NamedDBElementRepository
|
class StructuralDBElementRepository extends NamedDBElementRepository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,9 @@ use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
||||||
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
|
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Security\EnsureSAMLUserForSAMLLoginCheckerTest
|
||||||
|
*/
|
||||||
class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface
|
class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly TranslatorInterface $translator)
|
public function __construct(private readonly TranslatorInterface $translator)
|
||||||
|
|
|
@ -29,6 +29,9 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Security\SamlUserFactoryTest
|
||||||
|
*/
|
||||||
class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterface
|
class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterface
|
||||||
{
|
{
|
||||||
private readonly array $saml_role_mapping;
|
private readonly array $saml_role_mapping;
|
||||||
|
|
|
@ -29,6 +29,9 @@ use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Security\UserCheckerTest
|
||||||
|
*/
|
||||||
final class UserChecker implements UserCheckerInterface
|
final class UserChecker implements UserCheckerInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly TranslatorInterface $translator)
|
public function __construct(private readonly TranslatorInterface $translator)
|
||||||
|
|
|
@ -24,6 +24,9 @@ use Brick\Math\BigNumber;
|
||||||
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Serializer\BigNumberNormalizerTest
|
||||||
|
*/
|
||||||
class BigNumberNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
|
class BigNumberNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Serializer\PartNormalizerTest
|
||||||
|
*/
|
||||||
class PartNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface
|
class PartNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface
|
||||||
{
|
{
|
||||||
private const DENORMALIZE_KEY_MAPPING = [
|
private const DENORMALIZE_KEY_MAPPING = [
|
||||||
|
|
|
@ -27,6 +27,9 @@ use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Serializer\StructuralElementDenormalizerTest
|
||||||
|
*/
|
||||||
class StructuralElementDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface
|
class StructuralElementDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Serializer\StructuralElementFromNameDenormalizerTest
|
||||||
|
*/
|
||||||
class StructuralElementFromNameDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface
|
class StructuralElementFromNameDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly EntityManagerInterface $em)
|
public function __construct(private readonly EntityManagerInterface $em)
|
||||||
|
|
|
@ -25,6 +25,9 @@ use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Serializer\StructuralElementNormalizerTest
|
||||||
|
*/
|
||||||
class StructuralElementNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
|
class StructuralElementNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly ObjectNormalizer $normalizer)
|
public function __construct(private readonly ObjectNormalizer $normalizer)
|
||||||
|
|
|
@ -29,6 +29,7 @@ use Symfony\Component\Filesystem\Filesystem;
|
||||||
/**
|
/**
|
||||||
* This service converts the relative pathes for attachments saved in database (like %MEDIA%/img.jpg) to real pathes
|
* This service converts the relative pathes for attachments saved in database (like %MEDIA%/img.jpg) to real pathes
|
||||||
* an vice versa.
|
* an vice versa.
|
||||||
|
* @see \App\Tests\Services\Attachments\AttachmentPathResolverTest
|
||||||
*/
|
*/
|
||||||
class AttachmentPathResolver
|
class AttachmentPathResolver
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,9 @@ use function strlen;
|
||||||
use Symfony\Component\Asset\Packages;
|
use Symfony\Component\Asset\Packages;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\Attachments\AttachmentURLGeneratorTest
|
||||||
|
*/
|
||||||
class AttachmentURLGenerator
|
class AttachmentURLGenerator
|
||||||
{
|
{
|
||||||
protected string $public_path;
|
protected string $public_path;
|
||||||
|
|
|
@ -30,6 +30,7 @@ use Symfony\Contracts\Cache\CacheInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This service is used to find builtin attachment ressources.
|
* This service is used to find builtin attachment ressources.
|
||||||
|
* @see \App\Tests\Services\Attachments\BuiltinAttachmentsFinderTest
|
||||||
*/
|
*/
|
||||||
class BuiltinAttachmentsFinder
|
class BuiltinAttachmentsFinder
|
||||||
{
|
{
|
||||||
|
@ -57,7 +58,7 @@ class BuiltinAttachmentsFinder
|
||||||
foreach($finder as $file) {
|
foreach($finder as $file) {
|
||||||
$folder = $file->getRelativePath();
|
$folder = $file->getRelativePath();
|
||||||
//Normalize path (replace \ with /)
|
//Normalize path (replace \ with /)
|
||||||
$folder = str_replace('\\', '/', $folder);
|
$folder = str_replace('\\', '/', (string) $folder);
|
||||||
|
|
||||||
if(!isset($output[$folder])) {
|
if(!isset($output[$folder])) {
|
||||||
$output[$folder] = [];
|
$output[$folder] = [];
|
||||||
|
|
|
@ -32,6 +32,7 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||||
* A service that helps to work with filetype filters (based on the format <input type=file> accept uses).
|
* A service that helps to work with filetype filters (based on the format <input type=file> accept uses).
|
||||||
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers for
|
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers for
|
||||||
* more details.
|
* more details.
|
||||||
|
* @see \App\Tests\Services\Attachments\FileTypeFilterToolsTest
|
||||||
*/
|
*/
|
||||||
class FileTypeFilterTools
|
class FileTypeFilterTools
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,9 @@ use Doctrine\ORM\Mapping\Entity;
|
||||||
use function get_class;
|
use function get_class;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\ElementTypeNameGeneratorTest
|
||||||
|
*/
|
||||||
class ElementTypeNameGenerator
|
class ElementTypeNameGenerator
|
||||||
{
|
{
|
||||||
protected array $mapping;
|
protected array $mapping;
|
||||||
|
@ -127,7 +130,7 @@ class ElementTypeNameGenerator
|
||||||
{
|
{
|
||||||
$type = $this->getLocalizedTypeLabel($entity);
|
$type = $this->getLocalizedTypeLabel($entity);
|
||||||
if ($use_html) {
|
if ($use_html) {
|
||||||
return '<i>'.$type.':</i> '.htmlspecialchars($entity->getName());
|
return '<i>'.$type.':</i> '.htmlspecialchars((string) $entity->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $type.': '.$entity->getName();
|
return $type.': '.$entity->getName();
|
||||||
|
|
|
@ -29,6 +29,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This service formats a part amount using a Measurement Unit.
|
* This service formats a part amount using a Measurement Unit.
|
||||||
|
* @see \App\Tests\Services\Formatters\AmountFormatterTest
|
||||||
*/
|
*/
|
||||||
class AmountFormatter
|
class AmountFormatter
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace App\Services\Formatters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service that helps you to format values using the SI prefixes.
|
* A service that helps you to format values using the SI prefixes.
|
||||||
|
* @see \App\Tests\Services\Formatters\SIFormatterTest
|
||||||
*/
|
*/
|
||||||
class SIFormatter
|
class SIFormatter
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,9 @@ use League\Csv\Reader;
|
||||||
use Symfony\Component\HttpFoundation\File\File;
|
use Symfony\Component\HttpFoundation\File\File;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\ImportExportSystem\BOMImporterTest
|
||||||
|
*/
|
||||||
class BOMImporter
|
class BOMImporter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ use function Symfony\Component\String\u;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this class to export an entity to multiple file formats.
|
* Use this class to export an entity to multiple file formats.
|
||||||
|
* @see \App\Tests\Services\ImportExportSystem\EntityExporterTest
|
||||||
*/
|
*/
|
||||||
class EntityExporter
|
class EntityExporter
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\ImportExportSystem\EntityImporterTest
|
||||||
|
*/
|
||||||
class EntityImporter
|
class EntityImporter
|
||||||
{
|
{
|
||||||
public function __construct(protected SerializerInterface $serializer, protected EntityManagerInterface $em, protected ValidatorInterface $validator)
|
public function __construct(protected SerializerInterface $serializer, protected EntityManagerInterface $em, protected ValidatorInterface $validator)
|
||||||
|
|
|
@ -48,6 +48,9 @@ use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator;
|
||||||
use Com\Tecnick\Barcode\Barcode;
|
use Com\Tecnick\Barcode\Barcode;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\BarcodeGeneratorTest
|
||||||
|
*/
|
||||||
final class BarcodeGenerator
|
final class BarcodeGenerator
|
||||||
{
|
{
|
||||||
public function __construct(private readonly BarcodeContentGenerator $barcodeContentGenerator)
|
public function __construct(private readonly BarcodeContentGenerator $barcodeContentGenerator)
|
||||||
|
|
|
@ -48,6 +48,9 @@ use App\Entity\Parts\Storelocation;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeContentGeneratorTest
|
||||||
|
*/
|
||||||
final class BarcodeContentGenerator
|
final class BarcodeContentGenerator
|
||||||
{
|
{
|
||||||
public const PREFIX_MAP = [
|
public const PREFIX_MAP = [
|
||||||
|
|
|
@ -43,6 +43,9 @@ namespace App\Services\LabelSystem\Barcodes;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeNormalizerTest
|
||||||
|
*/
|
||||||
final class BarcodeNormalizer
|
final class BarcodeNormalizer
|
||||||
{
|
{
|
||||||
private const PREFIX_TYPE_MAP = [
|
private const PREFIX_TYPE_MAP = [
|
||||||
|
|
|
@ -47,6 +47,9 @@ use Doctrine\ORM\EntityNotFoundException;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeRedirectorTest
|
||||||
|
*/
|
||||||
final class BarcodeRedirector
|
final class BarcodeRedirector
|
||||||
{
|
{
|
||||||
public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly EntityManagerInterface $em)
|
public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly EntityManagerInterface $em)
|
||||||
|
|
|
@ -48,6 +48,9 @@ use App\Entity\Parts\Storelocation;
|
||||||
use Dompdf\Dompdf;
|
use Dompdf\Dompdf;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\LabelGeneratorTest
|
||||||
|
*/
|
||||||
final class LabelGenerator
|
final class LabelGenerator
|
||||||
{
|
{
|
||||||
public const CLASS_SUPPORT_MAPPING = [
|
public const CLASS_SUPPORT_MAPPING = [
|
||||||
|
|
|
@ -46,6 +46,7 @@ use App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface;
|
||||||
/**
|
/**
|
||||||
* This service replaces the Placeholders of the user provided lines with the proper informations.
|
* This service replaces the Placeholders of the user provided lines with the proper informations.
|
||||||
* It uses the PlaceholderProviders provided by PlaceholderProviderInterface classes.
|
* It uses the PlaceholderProviders provided by PlaceholderProviderInterface classes.
|
||||||
|
* @see \App\Tests\Services\LabelSystem\LabelTextReplacerTest
|
||||||
*/
|
*/
|
||||||
final class LabelTextReplacer
|
final class LabelTextReplacer
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides Placeholders for infos about global infos like Installation name or datetimes.
|
* Provides Placeholders for infos about global infos like Installation name or datetimes.
|
||||||
|
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\GlobalProvidersTest
|
||||||
*/
|
*/
|
||||||
final class GlobalProviders implements PlaceholderProviderInterface
|
final class GlobalProviders implements PlaceholderProviderInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,9 @@ namespace App\Services\LabelSystem\PlaceholderProviders;
|
||||||
|
|
||||||
use App\Entity\Contracts\NamedElementInterface;
|
use App\Entity\Contracts\NamedElementInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\NamedElementProviderTest
|
||||||
|
*/
|
||||||
final class NamedElementProvider implements PlaceholderProviderInterface
|
final class NamedElementProvider implements PlaceholderProviderInterface
|
||||||
{
|
{
|
||||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
||||||
|
|
|
@ -49,6 +49,9 @@ use App\Services\LabelSystem\LabelTextReplacer;
|
||||||
use IntlDateFormatter;
|
use IntlDateFormatter;
|
||||||
use Locale;
|
use Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\PartLotProviderTest
|
||||||
|
*/
|
||||||
final class PartLotProvider implements PlaceholderProviderInterface
|
final class PartLotProvider implements PlaceholderProviderInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly LabelTextReplacer $labelTextReplacer, private readonly AmountFormatter $amountFormatter)
|
public function __construct(private readonly LabelTextReplacer $labelTextReplacer, private readonly AmountFormatter $amountFormatter)
|
||||||
|
|
|
@ -49,6 +49,9 @@ use App\Services\Formatters\SIFormatter;
|
||||||
use Parsedown;
|
use Parsedown;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\PartProviderTest
|
||||||
|
*/
|
||||||
final class PartProvider implements PlaceholderProviderInterface
|
final class PartProvider implements PlaceholderProviderInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly SIFormatter $siFormatter, private readonly TranslatorInterface $translator)
|
public function __construct(private readonly SIFormatter $siFormatter, private readonly TranslatorInterface $translator)
|
||||||
|
|
|
@ -46,6 +46,9 @@ use DateTime;
|
||||||
use IntlDateFormatter;
|
use IntlDateFormatter;
|
||||||
use Locale;
|
use Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\TimestampableElementProviderTest
|
||||||
|
*/
|
||||||
final class TimestampableElementProvider implements PlaceholderProviderInterface
|
final class TimestampableElementProvider implements PlaceholderProviderInterface
|
||||||
{
|
{
|
||||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
||||||
|
|
|
@ -68,6 +68,9 @@ use Twig\Extra\Intl\IntlExtension;
|
||||||
use Twig\Loader\ArrayLoader;
|
use Twig\Loader\ArrayLoader;
|
||||||
use Twig\Sandbox\SecurityPolicyInterface;
|
use Twig\Sandbox\SecurityPolicyInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LabelSystem\SandboxedTwigProviderTest
|
||||||
|
*/
|
||||||
final class SandboxedTwigProvider
|
final class SandboxedTwigProvider
|
||||||
{
|
{
|
||||||
private const ALLOWED_TAGS = ['apply', 'autoescape', 'do', 'for', 'if', 'set', 'verbatim', 'with'];
|
private const ALLOWED_TAGS = ['apply', 'autoescape', 'do', 'for', 'if', 'set', 'verbatim', 'with'];
|
||||||
|
|
|
@ -41,6 +41,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Services\LogSystem;
|
namespace App\Services\LogSystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LogSystem\EventCommentHelperTest
|
||||||
|
*/
|
||||||
class EventCommentHelper
|
class EventCommentHelper
|
||||||
{
|
{
|
||||||
protected const MAX_MESSAGE_LENGTH = 255;
|
protected const MAX_MESSAGE_LENGTH = 255;
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace App\Services\LogSystem;
|
||||||
/**
|
/**
|
||||||
* This service is used to check if a log change comment is needed for a given operation type.
|
* This service is used to check if a log change comment is needed for a given operation type.
|
||||||
* It is configured using the "enforce_change_comments_for" config parameter.
|
* It is configured using the "enforce_change_comments_for" config parameter.
|
||||||
|
* @see \App\Tests\Services\LogSystem\EventCommentNeededHelperTest
|
||||||
*/
|
*/
|
||||||
class EventCommentNeededHelper
|
class EventCommentNeededHelper
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,9 @@ use App\Entity\UserSystem\User;
|
||||||
use App\Services\Misc\ConsoleInfoHelper;
|
use App\Services\Misc\ConsoleInfoHelper;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\LogSystem\EventLoggerTest
|
||||||
|
*/
|
||||||
class EventLogger
|
class EventLogger
|
||||||
{
|
{
|
||||||
public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected Security $security, protected ConsoleInfoHelper $console_info_helper)
|
public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected Security $security, protected ConsoleInfoHelper $console_info_helper)
|
||||||
|
|
|
@ -26,6 +26,9 @@ use App\Entity\Attachments\Attachment;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\Misc\FAIconGeneratorTest
|
||||||
|
*/
|
||||||
class FAIconGenerator
|
class FAIconGenerator
|
||||||
{
|
{
|
||||||
protected const EXT_MAPPING = [
|
protected const EXT_MAPPING = [
|
||||||
|
|
|
@ -45,6 +45,7 @@ use InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Parser allows to parse number ranges like 1-3, 4, 5.
|
* This Parser allows to parse number ranges like 1-3, 4, 5.
|
||||||
|
* @see \App\Tests\Services\Misc\RangeParserTest
|
||||||
*/
|
*/
|
||||||
class RangeParser
|
class RangeParser
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,9 @@ use InvalidArgumentException;
|
||||||
|
|
||||||
use function preg_match;
|
use function preg_match;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\Parameters\ParameterExtractorTest
|
||||||
|
*/
|
||||||
class ParameterExtractor
|
class ParameterExtractor
|
||||||
{
|
{
|
||||||
protected const ALLOWED_PARAM_SEPARATORS = [', ', "\n"];
|
protected const ALLOWED_PARAM_SEPARATORS = [', ', "\n"];
|
||||||
|
|
|
@ -8,6 +8,9 @@ use App\Entity\Parts\PartLot;
|
||||||
use App\Services\LogSystem\EventCommentHelper;
|
use App\Services\LogSystem\EventCommentHelper;
|
||||||
use App\Services\LogSystem\EventLogger;
|
use App\Services\LogSystem\EventLogger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\Parts\PartLotWithdrawAddHelperTest
|
||||||
|
*/
|
||||||
final class PartLotWithdrawAddHelper
|
final class PartLotWithdrawAddHelper
|
||||||
{
|
{
|
||||||
public function __construct(private readonly EventLogger $eventLogger, private readonly EventCommentHelper $eventCommentHelper)
|
public function __construct(private readonly EventLogger $eventLogger, private readonly EventCommentHelper $eventCommentHelper)
|
||||||
|
|
|
@ -32,6 +32,9 @@ use Locale;
|
||||||
|
|
||||||
use function count;
|
use function count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\Parts\PricedetailHelperTest
|
||||||
|
*/
|
||||||
class PricedetailHelper
|
class PricedetailHelper
|
||||||
{
|
{
|
||||||
protected string $locale;
|
protected string $locale;
|
||||||
|
@ -54,7 +57,7 @@ class PricedetailHelper
|
||||||
foreach ($orderdetails as $orderdetail) {
|
foreach ($orderdetails as $orderdetail) {
|
||||||
$pricedetails = $orderdetail->getPricedetails();
|
$pricedetails = $orderdetail->getPricedetails();
|
||||||
//The orderdetail must have pricedetails, otherwise this will not work!
|
//The orderdetail must have pricedetails, otherwise this will not work!
|
||||||
if (0 === count($pricedetails)) {
|
if (0 === (is_countable($pricedetails) ? count($pricedetails) : 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +102,7 @@ class PricedetailHelper
|
||||||
foreach ($orderdetails as $orderdetail) {
|
foreach ($orderdetails as $orderdetail) {
|
||||||
$pricedetails = $orderdetail->getPricedetails();
|
$pricedetails = $orderdetail->getPricedetails();
|
||||||
//The orderdetail must have pricedetails, otherwise this will not work!
|
//The orderdetail must have pricedetails, otherwise this will not work!
|
||||||
if (0 === count($pricedetails)) {
|
if (0 === (is_countable($pricedetails) ? count($pricedetails) : 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@ use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||||
use App\Helpers\Projects\ProjectBuildRequest;
|
use App\Helpers\Projects\ProjectBuildRequest;
|
||||||
use App\Services\Parts\PartLotWithdrawAddHelper;
|
use App\Services\Parts\PartLotWithdrawAddHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\ProjectSystem\ProjectBuildHelperTest
|
||||||
|
*/
|
||||||
class ProjectBuildHelper
|
class ProjectBuildHelper
|
||||||
{
|
{
|
||||||
public function __construct(private readonly PartLotWithdrawAddHelper $withdraw_add_helper)
|
public function __construct(private readonly PartLotWithdrawAddHelper $withdraw_add_helper)
|
||||||
|
|
|
@ -5,6 +5,9 @@ namespace App\Services\ProjectSystem;
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use App\Entity\ProjectSystem\Project;
|
use App\Entity\ProjectSystem\Project;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\ProjectSystem\ProjectBuildPartHelperTest
|
||||||
|
*/
|
||||||
class ProjectBuildPartHelper
|
class ProjectBuildPartHelper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,7 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This service gives you a flat list containing all structured entities in the order of the structure.
|
* This service gives you a flat list containing all structured entities in the order of the structure.
|
||||||
|
* @see \App\Tests\Services\Trees\NodesListBuilderTest
|
||||||
*/
|
*/
|
||||||
class NodesListBuilder
|
class NodesListBuilder
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
use function count;
|
use function count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\Trees\TreeViewGeneratorTest
|
||||||
|
*/
|
||||||
class TreeViewGenerator
|
class TreeViewGenerator
|
||||||
{
|
{
|
||||||
public function __construct(protected EntityURLGenerator $urlGenerator, protected EntityManagerInterface $em, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected TranslatorInterface $translator, protected bool $rootNodeExpandedByDefault, protected bool $rootNodeEnabled)
|
public function __construct(protected EntityURLGenerator $urlGenerator, protected EntityManagerInterface $em, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected TranslatorInterface $translator, protected bool $rootNodeExpandedByDefault, protected bool $rootNodeEnabled)
|
||||||
|
@ -130,43 +133,29 @@ class TreeViewGenerator
|
||||||
|
|
||||||
protected function entityClassToRootNodeString(string $class): string
|
protected function entityClassToRootNodeString(string $class): string
|
||||||
{
|
{
|
||||||
switch ($class) {
|
return match ($class) {
|
||||||
case Category::class:
|
Category::class => $this->translator->trans('category.labelp'),
|
||||||
return $this->translator->trans('category.labelp');
|
Storelocation::class => $this->translator->trans('storelocation.labelp'),
|
||||||
case Storelocation::class:
|
Footprint::class => $this->translator->trans('footprint.labelp'),
|
||||||
return $this->translator->trans('storelocation.labelp');
|
Manufacturer::class => $this->translator->trans('manufacturer.labelp'),
|
||||||
case Footprint::class:
|
Supplier::class => $this->translator->trans('supplier.labelp'),
|
||||||
return $this->translator->trans('footprint.labelp');
|
Project::class => $this->translator->trans('project.labelp'),
|
||||||
case Manufacturer::class:
|
default => $this->translator->trans('tree.root_node.text'),
|
||||||
return $this->translator->trans('manufacturer.labelp');
|
};
|
||||||
case Supplier::class:
|
|
||||||
return $this->translator->trans('supplier.labelp');
|
|
||||||
case Project::class:
|
|
||||||
return $this->translator->trans('project.labelp');
|
|
||||||
default:
|
|
||||||
return $this->translator->trans('tree.root_node.text');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function entityClassToRootNodeIcon(string $class): ?string
|
protected function entityClassToRootNodeIcon(string $class): ?string
|
||||||
{
|
{
|
||||||
$icon = "fa-fw fa-treeview fa-solid ";
|
$icon = "fa-fw fa-treeview fa-solid ";
|
||||||
switch ($class) {
|
return match ($class) {
|
||||||
case Category::class:
|
Category::class => $icon . 'fa-tags',
|
||||||
return $icon . 'fa-tags';
|
Storelocation::class => $icon . 'fa-cube',
|
||||||
case Storelocation::class:
|
Footprint::class => $icon . 'fa-microchip',
|
||||||
return $icon . 'fa-cube';
|
Manufacturer::class => $icon . 'fa-industry',
|
||||||
case Footprint::class:
|
Supplier::class => $icon . 'fa-truck',
|
||||||
return $icon . 'fa-microchip';
|
Project::class => $icon . 'fa-archive',
|
||||||
case Manufacturer::class:
|
default => null,
|
||||||
return $icon . 'fa-industry';
|
};
|
||||||
case Supplier::class:
|
|
||||||
return $icon . 'fa-truck';
|
|
||||||
case Project::class:
|
|
||||||
return $icon . 'fa-archive';
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,6 +37,7 @@ use Symfony\Component\Yaml\Yaml;
|
||||||
* This class manages the permissions of users and groups.
|
* This class manages the permissions of users and groups.
|
||||||
* Permissions are defined in the config/permissions.yaml file, and are parsed and resolved by this class using the
|
* Permissions are defined in the config/permissions.yaml file, and are parsed and resolved by this class using the
|
||||||
* user and hierachical group PermissionData information.
|
* user and hierachical group PermissionData information.
|
||||||
|
* @see \App\Tests\Services\UserSystem\PermissionManagerTest
|
||||||
*/
|
*/
|
||||||
class PermissionManager
|
class PermissionManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,9 @@ use App\Entity\UserSystem\PermissionData;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Security\Interfaces\HasPermissionsInterface;
|
use App\Security\Interfaces\HasPermissionsInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Services\UserSystem\PermissionSchemaUpdaterTest
|
||||||
|
*/
|
||||||
class PermissionSchemaUpdater
|
class PermissionSchemaUpdater
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,7 @@ use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class generates random backup codes for two-factor authentication.
|
* This class generates random backup codes for two-factor authentication.
|
||||||
|
* @see \App\Tests\Services\UserSystem\TFA\BackupCodeGeneratorTest
|
||||||
*/
|
*/
|
||||||
class BackupCodeGenerator
|
class BackupCodeGenerator
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ use App\Entity\UserSystem\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This services offers methods to manage backup codes for two-factor authentication.
|
* This services offers methods to manage backup codes for two-factor authentication.
|
||||||
|
* @see \App\Tests\Services\UserSystem\TFA\BackupCodeManagerTest
|
||||||
*/
|
*/
|
||||||
class BackupCodeManager
|
class BackupCodeManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,9 @@ use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
use Twig\TwigTest;
|
use Twig\TwigTest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Twig\EntityExtensionTest
|
||||||
|
*/
|
||||||
final class EntityExtension extends AbstractExtension
|
final class EntityExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
public function __construct(protected EntityURLGenerator $entityURLGenerator, protected TreeViewGenerator $treeBuilder, private readonly ElementTypeNameGenerator $nameGenerator)
|
public function __construct(protected EntityURLGenerator $entityURLGenerator, protected TreeViewGenerator $treeBuilder, private readonly ElementTypeNameGenerator $nameGenerator)
|
||||||
|
|
|
@ -27,6 +27,7 @@ use Twig\TwigTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The functionalities here extend the Twig with some core functions, which are independently of Part-DB.
|
* The functionalities here extend the Twig with some core functions, which are independently of Part-DB.
|
||||||
|
* @see \App\Tests\Twig\TwigCoreExtensionTest
|
||||||
*/
|
*/
|
||||||
final class TwigCoreExtension extends AbstractExtension
|
final class TwigCoreExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,9 @@ use Twig\Extension\AbstractExtension;
|
||||||
use Twig\TwigFilter;
|
use Twig\TwigFilter;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see \App\Tests\Twig\UserExtensionTest
|
||||||
|
*/
|
||||||
final class UserExtension extends AbstractExtension
|
final class UserExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
private readonly LogEntryRepository $repo;
|
private readonly LogEntryRepository $repo;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue