Skip to content

Commit

Permalink
Apply coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus committed Sep 25, 2024
1 parent 9f4c33e commit 6835827
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

final class Plugin implements BundlePluginInterface
{
/** {@inheritDoc} */
public function getBundles(ParserInterface $parser): array
{
return [
Expand Down
1 change: 1 addition & 0 deletions src/DependencyInjection/HofffContaoIconFontExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

final class HofffContaoIconFontExtension extends Extension
{
/** {@inheritDoc} */
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
Expand Down
78 changes: 48 additions & 30 deletions src/EventListener/ReplaceInsertTagsListener.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

declare(strict_types=1);

namespace Hofff\Contao\IconFont\EventListener;

use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;

use function explode;
use function sprintf;

/**
* @author Nicky Hoff <[email protected]>
*
* @Hook("replaceInsertTags")
*/
#[AsHook('replaceInsertTags')]
final class ReplaceInsertTagsListener
{
private const ICONS = [
Expand Down Expand Up @@ -98,40 +99,57 @@ final class ReplaceInsertTagsListener
'icon-fab-flip-both' => '<i class="fab fa-%s fa-flip-both" aria-hidden="true"></i>',

// Icons mit quadratischem Hintergrund
'icon-fas-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true"></i><i class="fas fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-far-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true"></i><i class="far fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fal-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true"></i><i class="fal fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fab-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true"></i><i class="fab fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fas-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="fas fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-far-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="far fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fal-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="fal fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fab-square' => '<span class="fa-stack"><i class="fas fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="fab fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',

// Icons mit quadratischem Hintergrund - nur Umrandung
'icon-fas-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true"></i><i class="fas fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-far-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true"></i><i class="far fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fal-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true"></i><i class="fal fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fab-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true"></i><i class="fab fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fas-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="fas fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-far-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="far fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fal-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="fal fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fab-square-border' => '<span class="fa-stack"><i class="far fa-square fa-stack-2x" aria-hidden="true">'
. '</i><i class="fab fa-%s fa-stack-1x" aria-hidden="true"></i></span>',

// Icons mit rundem Hintergrund
'icon-fas-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true"></i><i class="fas fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-far-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true"></i><i class="far fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fal-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true"></i><i class="fal fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fab-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true"></i><i class="fab fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fas-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="fas fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-far-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="far fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fal-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="fal fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',
'icon-fab-circle' => '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="fab fa-%s fa-stack-1x fa-inverse" aria-hidden="true"></i></span>',

// Icons mit rundem Hintergrund - nur Umrandung
'icon-fas-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true"></i><i class="fas fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-far-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true"></i><i class="far fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fal-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true"></i><i class="fal fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fab-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true"></i><i class="fab fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fas-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="fas fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-far-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="far fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fal-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="fal fa-%s fa-stack-1x" aria-hidden="true"></i></span>',
'icon-fab-circle-border' => '<span class="fa-stack"><i class="far fa-circle fa-stack-2x" aria-hidden="true">'
. '</i><i class="fab fa-%s fa-stack-1x" aria-hidden="true"></i></span>',

// Icons mit Verbotsschild (Farbe für .fa-ban muss per CSS gesetzt werden)
'icon-fas-ban' => '<span class="fa-stack"><i class="fas fa-%s fa-stack-1x" aria-hidden="true"></i><i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
'icon-far-ban' => '<span class="fa-stack"><i class="far fa-%s fa-stack-1x" aria-hidden="true"></i><i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
'icon-fal-ban' => '<span class="fa-stack"><i class="fal fa-%s fa-stack-1x" aria-hidden="true"></i><i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
'icon-fab-ban' => '<span class="fa-stack"><i class="fab fa-%s fa-stack-1x" aria-hidden="true"></i><i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
'icon-fas-ban' => '<span class="fa-stack"><i class="fas fa-%s fa-stack-1x" aria-hidden="true"></i>'
. '<i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
'icon-far-ban' => '<span class="fa-stack"><i class="far fa-%s fa-stack-1x" aria-hidden="true"></i>'
. '<i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
'icon-fal-ban' => '<span class="fa-stack"><i class="fal fa-%s fa-stack-1x" aria-hidden="true"></i>'
. '<i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
'icon-fab-ban' => '<span class="fa-stack"><i class="fab fa-%s fa-stack-1x" aria-hidden="true"></i>'
. '<i class="fas fa-ban fa-stack-2x" aria-hidden="true"></i></span>',
];

/**
* @return bool|string
*/
public function __invoke(string $tag)
public function __invoke(string $tag): bool|string
{
$split = explode('::', $tag);

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
https://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<defaults autowire="false" autoconfigure="false" public="false"/>
<defaults autowire="false" autoconfigure="true" public="false"/>

<service id="Hofff\Contao\IconFont\EventListener\ReplaceInsertTagsListener"/>
</services>
Expand Down

0 comments on commit 6835827

Please sign in to comment.