style: fix indentation, alignment, and docblock annotations
- Correct getChoices() docblock to reflect translated label => enum backing value order instead of value => label - Re-indent Smart Links menu config to match actual array nesting - Align assignment operators in RefreshStatsCommand - Add missing newline at end of RefreshStatsCommand.php
This commit is contained in:
1 parent
07773acb8d
commit
b138056e43
90 files changed
+622
-272
No files matched your search
@@ -4,13 +4,21 @@ declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\MT3SMarketingProgramBundle\Controller;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Mautic\CoreBundle\Controller\CommonController;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\SmartLink;
|
||||
use Mautic\CoreBundle\Factory\ModelFactory;
|
||||
use Mautic\CoreBundle\Helper\CoreParametersHelper;
|
||||
use Mautic\CoreBundle\Helper\UserHelper;
|
||||
use Mautic\CoreBundle\Security\Permissions\CorePermissions;
|
||||
use Mautic\CoreBundle\Service\FlashBag;
|
||||
use Mautic\CoreBundle\Translation\Translator;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Model\SmartLinkModel;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Contracts\Service\Attribute\Required;
|
||||
|
||||
/**
|
||||
* The public side of the Smart Links: https://{short_link_domain}/l/{slug}.
|
||||
@@ -24,12 +32,20 @@ use Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
class PublicController extends CommonController
|
||||
{
|
||||
private SmartLinkModel $smartLinkModel;
|
||||
|
||||
#[Required]
|
||||
public function autowirePublicController(SmartLinkModel $smartLinkModel): void
|
||||
{
|
||||
$this->smartLinkModel = $smartLinkModel;
|
||||
public function __construct(
|
||||
private readonly SmartLinkModel $smartLinkModel,
|
||||
private readonly LoggerInterface $logger,
|
||||
ManagerRegistry $doctrine,
|
||||
ModelFactory $modelFactory,
|
||||
UserHelper $userHelper,
|
||||
CoreParametersHelper $coreParametersHelper,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
Translator $translator,
|
||||
FlashBag $flashBag,
|
||||
RequestStack $requestStack,
|
||||
CorePermissions $security,
|
||||
) {
|
||||
parent::__construct($doctrine, $modelFactory, $userHelper, $coreParametersHelper, $dispatcher, $translator, $flashBag, $requestStack, $security);
|
||||
}
|
||||
|
||||
public function goAction(Request $request, string $slug): Response
|
||||
@@ -64,7 +80,14 @@ class PublicController extends CommonController
|
||||
$this->smartLinkModel->recordHit($link, $request);
|
||||
} catch (\Throwable $e) {
|
||||
// Statistics must never block the redirect.
|
||||
error_log('Smart Link hit could not be recorded for slug "'.$slug.'": '.$e->getMessage().' in '.$e->getFile().':'.$e->getLine());
|
||||
$this->logger->error(
|
||||
'Smart Link hit could not be recorded for slug "{slug}": {message}',
|
||||
[
|
||||
'slug' => $slug,
|
||||
'message' => $e->getMessage(),
|
||||
'exception' => $e,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return new RedirectResponse($this->smartLinkModel->buildRedirectUrl($link), $link->getRedirectCode()->value);
|
||||
|
||||
Reference in new issue
Block a user