Skip to content

Commit fb93a0e

Browse files
committed
run ecs
1 parent c180ec6 commit fb93a0e

14 files changed

Lines changed: 87 additions & 47 deletions

contao/dca/tl_page.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,31 @@
4646
'label' => &$GLOBALS['TL_LANG']['tl_page']['addHeadDefaultImage'],
4747
'exclude' => true,
4848
'inputType' => 'checkbox',
49-
'eval' => ['submitOnChange' => true, 'tl_class' => 'w50 clr'],
49+
'eval' => [
50+
'submitOnChange' => true,
51+
'tl_class' => 'w50 clr',
52+
],
5053
'sql' => "char(1) NOT NULL default ''",
5154
],
5255
'headDefaultImage' => [
5356
'label' => &$GLOBALS['TL_LANG']['tl_page']['headDefaultImage'],
5457
'exclude' => true,
5558
'inputType' => 'fileTree',
56-
'eval' => ['fieldType' => 'radio', 'filesOnly' => true, 'extensions' => 'jpg,jpeg,png', 'mandatory' => true],
59+
'eval' => [
60+
'fieldType' => 'radio',
61+
'filesOnly' => true,
62+
'extensions' => 'jpg,jpeg,png',
63+
'mandatory' => true,
64+
],
5765
'sql' => 'binary(16) NULL',
5866
],
5967
'twitterSite' => [
6068
'label' => &$GLOBALS['TL_LANG']['tl_page']['twitterSite'],
6169
'inputType' => 'text',
6270
'exclude' => true,
63-
'eval' => ['tl_class' => 'w50 clr'],
71+
'eval' => [
72+
'tl_class' => 'w50 clr',
73+
],
6474
'sql' => "varchar(255) NOT NULL DEFAULT ''",
6575
],
6676
'headAddOrganisationSchema' => [
@@ -94,7 +104,12 @@
94104
'headOrganisationLogo' => [
95105
'inputType' => 'fileTree',
96106
'exclude' => true,
97-
'eval' => ['tl_class' => 'w50 clr', 'fieldType' => 'radio', 'filesOnly' => true, 'extensions' => 'jpg,jpeg,png'],
107+
'eval' => [
108+
'tl_class' => 'w50 clr',
109+
'fieldType' => 'radio',
110+
'filesOnly' => true,
111+
'extensions' => 'jpg,jpeg,png',
112+
],
98113
'sql' => 'binary(16) NULL',
99114
],
100115
'headAddWebSiteSchema' => [

ecs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
return ECSConfig::configure()
1212
->withPaths([
1313
__DIR__ . '/src',
14-
// __DIR__ . '/contao',
14+
__DIR__ . '/contao',
1515

1616
])
1717

src/DependencyInjection/HeimrichHannotHeadBundleExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function load(array $configs, ContainerBuilder $container): void
2121
$config = $this->processConfiguration($configuration, $configs);
2222
$container->setParameter('huh_head', $config);
2323

24-
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
24+
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
2525
$loader->load('services.yaml');
2626
}
2727

src/EventListener/Contao/GeneratePageListener.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@
3434
#[AsHook('generatePage', priority: -10)]
3535
class GeneratePageListener implements ServiceSubscriberInterface
3636
{
37-
public function __construct(private readonly ContainerInterface $container, private array $config, private readonly HtmlHeadTagManager $headTagManager, private readonly RequestStack $requestStack, private readonly Utils $utils, private readonly TagHelper $tagHelper, private readonly InsertTagParser $insertTagParser)
38-
{
37+
public function __construct(
38+
private readonly ContainerInterface $container,
39+
private array $config,
40+
private readonly HtmlHeadTagManager $headTagManager,
41+
private readonly RequestStack $requestStack,
42+
private readonly Utils $utils,
43+
private readonly TagHelper $tagHelper,
44+
private readonly InsertTagParser $insertTagParser,
45+
) {
3946
}
4047

4148
public function __invoke(PageModel $pageModel, LayoutModel $layout, PageRegular $pageRegular): void
@@ -62,7 +69,7 @@ public function __invoke(PageModel $pageModel, LayoutModel $layout, PageRegular
6269
public static function getSubscribedServices(): array
6370
{
6471
return [
65-
'?' . ResponseContextAccessor::class,
72+
'?'.ResponseContextAccessor::class,
6673
];
6774
}
6875

@@ -196,7 +203,7 @@ protected function setOpenGraphTags(string $title, string $description): void
196203
$url = $headTagBag->getCanonicalUriForRequest($request);
197204
} else {
198205
$url = Request::create(
199-
$request->getSchemeAndHttpHost() . $request->getBaseUrl() . $request->getPathInfo(),
206+
$request->getSchemeAndHttpHost().$request->getBaseUrl().$request->getPathInfo(),
200207
$request->getMethod(),
201208
)->getUri();
202209
}
@@ -270,7 +277,6 @@ private function prepareJsonLdContent(PageModel $pageModel): void
270277
'pageModel' => $pageModel,
271278
]));
272279
}
273-
274280
}
275281

276282
private function getJsonLdManager(): ?JsonLdManager

src/EventListener/Contao/GetPageLayoutListener.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
#[AsHook('getPageLayout', priority: -10)]
2222
class GetPageLayoutListener
2323
{
24-
public function __construct(private readonly Utils $utils, private readonly HtmlHeadTagManager $headTagManager, private readonly ImageFactoryInterface $imageFactory)
25-
{
24+
public function __construct(
25+
private readonly Utils $utils,
26+
private readonly HtmlHeadTagManager $headTagManager,
27+
private readonly ImageFactoryInterface $imageFactory,
28+
) {
2629
}
2730

2831
public function __invoke(PageModel $pageModel, LayoutModel $layout, PageRegular $pageRegular): void
@@ -62,12 +65,12 @@ private function setPageFallbackImage(PageModel $pageModel): void
6265

6366
if (!$metaImageTag) {
6467
$metaImagePath = $this->imageFactory->create($imagePath, [1200, 630, 'proportional'])->getPath();
65-
$this->headTagManager->addMetaTag(new PropertyMetaTag('og:image', $baseUrl . \DIRECTORY_SEPARATOR . $metaImagePath));
68+
$this->headTagManager->addMetaTag(new PropertyMetaTag('og:image', $baseUrl.\DIRECTORY_SEPARATOR.$metaImagePath));
6669
}
6770

6871
if (!$twitterImageTag) {
6972
$twitterImagePath = $this->imageFactory->create($imagePath, [1024, 512, 'proportional'])->getPath();
70-
$this->headTagManager->addMetaTag(new MetaTag('twitter:image', $baseUrl . \DIRECTORY_SEPARATOR . $twitterImagePath));
73+
$this->headTagManager->addMetaTag(new MetaTag('twitter:image', $baseUrl.\DIRECTORY_SEPARATOR.$twitterImagePath));
7174
}
7275
}
7376

@@ -86,7 +89,9 @@ protected function pageImage(?PageModel $pageModel): ?string
8689
return null;
8790
}
8891

89-
return $this->utils->file()->getPathFromUuid($pageModel->headDefaultImage, ['absolutePath' => true]);
92+
return $this->utils->file()->getPathFromUuid($pageModel->headDefaultImage, [
93+
'absolutePath' => true,
94+
]);
9095
}
9196

9297
/**
@@ -101,7 +106,7 @@ private function setTwitterTags(PageModel $pageModel): void
101106
}
102107

103108
$this->headTagManager->addMetaTag(
104-
new MetaTag('twitter:site', (str_starts_with($pageModel->twitterSite, '@') ? '@' : '') . $rootPageModel->twitterSite)
109+
new MetaTag('twitter:site', (str_starts_with($pageModel->twitterSite, '@') ? '@' : '').$rootPageModel->twitterSite)
105110
);
106111
}
107112
}

src/EventListener/Contao/ParseTemplateListener.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#[AsHook('parseTemplate')]
1616
class ParseTemplateListener
1717
{
18-
public function __construct(private array $bundleConfig, private readonly HtmlHeadTagManager $headTagManager)
19-
{
18+
public function __construct(
19+
private array $bundleConfig,
20+
private readonly HtmlHeadTagManager $headTagManager,
21+
) {
2022
}
2123

2224
public function __invoke(Template $template): void
@@ -31,7 +33,7 @@ protected function addLegacyMetaMethod(Template $template): void
3133
}
3234

3335
if (!($this->bundleConfig['use_contao_variables'] ?? false)) {
34-
$template->meta = (fn(array $skip = []) => $this->headTagManager->renderTags([
36+
$template->meta = (fn (array $skip = []) => $this->headTagManager->renderTags([
3537
'skip_tags' => $skip,
3638
]));
3739
}

src/EventListener/Contao/ReplaceDynamicScriptTagsListener.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#[AsHook('replaceDynamicScriptTags')]
1616
class ReplaceDynamicScriptTagsListener
1717
{
18-
public function __construct(private array $bundleConfig, private readonly HtmlHeadTagManager $headTagManager)
19-
{
18+
public function __construct(
19+
private array $bundleConfig,
20+
private readonly HtmlHeadTagManager $headTagManager,
21+
) {
2022
}
2123

2224
/**
@@ -37,14 +39,15 @@ private function addHeadTags(string $buffer): string
3739

3840
return $buffer;
3941
}
42+
4043
private function replace(string $buffer, string $tag, string $content): string
4144
{
4245
$nonce = '';
4346

4447
if (method_exists(ContaoFramework::class, 'getNonce')) {
45-
$nonce = '_' . ContaoFramework::getNonce();
48+
$nonce = '_'.ContaoFramework::getNonce();
4649
}
4750

48-
return str_replace("[[$tag$nonce]]", "[[$tag$nonce]]" . $content, $buffer);
51+
return str_replace("[[$tag$nonce]]", "[[$tag$nonce]]".$content, $buffer);
4952
}
5053
}

src/HeadTag/AbstractHeadTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function generateAttributeString(): string
2626
return '';
2727
}
2828

29-
$compiled = implode('="%s" ', array_keys($this->attributes)) . '="%s"';
29+
$compiled = implode('="%s" ', array_keys($this->attributes)).'="%s"';
3030

3131
return vsprintf($compiled, array_map(htmlspecialchars(...), array_values($this->attributes)));
3232
}

src/HeadTag/HeadTagFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515

1616
class HeadTagFactory
1717
{
18-
public function __construct(private readonly TagHelper $tagHelper)
19-
{
18+
public function __construct(
19+
private readonly TagHelper $tagHelper,
20+
) {
2021
}
2122

2223
/**
2324
* Create a tag by name.
2425
* For tags with multiple occurrences like meta, prefix name with tag name,
2526
* for example meta_ (meta_description, meta_og:title, ...) for meta tags.
26-
*
2727
*/
2828
public function createTagByName(string $name, ?string $value = null): ?AbstractHeadTag
2929
{

src/HeadTag/LinkTag.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ class LinkTag extends AbstractHeadTag
1313
/*
1414
* @param string $name An internal name of the link tag to identify it. Will not be used in the resulting code.
1515
*/
16-
public function __construct(private string $name, string $rel, ?string $href = null)
17-
{
16+
public function __construct(
17+
private string $name,
18+
string $rel,
19+
?string $href = null,
20+
) {
1821
$this->setAttribute('rel', $rel);
1922
$this->setAttribute('href', $href);
2023
}

0 commit comments

Comments
 (0)