Skip to content

Commit 33c6d60

Browse files
driesvintsgithub-actions[bot]
authored andcommitted
Fix code styling
1 parent 24386fa commit 33c6d60

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

app/Crawler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ public function sendRequests(RequestInterface ...$requests): array
6969
$requests
7070
),
7171
]);
72+
7273
return $this->client->sendRequests(...$requests);
7374
}
74-
75+
7576
info('Crawler::sendRequests regular', [
7677
'requests' => array_map(
7778
fn ($request) => $request->getUri(),

app/DomainFilteringAdapter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class DomainFilteringAdapter implements EmbedAdapterInterface
2424
private string $regex;
2525

2626
/**
27-
* @param string[] $allowedDomains
27+
* @param string[] $allowedDomains
2828
*/
2929
public function __construct(EmbedAdapterInterface $decorated, array $allowedDomains)
3030
{
3131
$this->decorated = $decorated;
32-
$this->regex = self::createRegex($allowedDomains);
32+
$this->regex = self::createRegex($allowedDomains);
3333
}
3434

3535
/**
@@ -44,14 +44,14 @@ public function updateEmbeds(array $embeds): void
4444
}
4545

4646
/**
47-
* @param string[] $allowedDomains
47+
* @param string[] $allowedDomains
4848
*
4949
* @psalm-return non-empty-string
5050
*/
5151
private static function createRegex(array $allowedDomains): string
5252
{
5353
$allowedDomains = \array_map('preg_quote', $allowedDomains);
5454

55-
return '/^(?:https?:\/\/)?(?:[^.]+\.)*(' . \implode('|', $allowedDomains) . ')/';
55+
return '/^(?:https?:\/\/)?(?:[^.]+\.)*('.\implode('|', $allowedDomains).')/';
5656
}
5757
}

app/EmbedExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public function register(EnvironmentBuilderInterface $environment): void
4545
}
4646

4747
$environment
48-
->addBlockStartParser(new EmbedStartParser(), 300)
48+
->addBlockStartParser(new EmbedStartParser, 300)
4949
->addEventListener(DocumentParsedEvent::class, new EmbedProcessor($adapter, $environment->getConfiguration()->get('embed.fallback')), 1010)
50-
->addRenderer(Embed::class, new EmbedRenderer());
50+
->addRenderer(Embed::class, new EmbedRenderer);
5151
}
5252
}

app/EmbedProcessor.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,37 @@
2424
final class EmbedProcessor
2525
{
2626
public const FALLBACK_REMOVE = 'remove';
27-
public const FALLBACK_LINK = 'link';
27+
28+
public const FALLBACK_LINK = 'link';
2829

2930
private EmbedAdapterInterface $adapter;
31+
3032
private string $fallback;
3133

3234
public function __construct(EmbedAdapterInterface $adapter, string $fallback = self::FALLBACK_REMOVE)
3335
{
34-
$this->adapter = $adapter;
36+
$this->adapter = $adapter;
3537
$this->fallback = $fallback;
3638
}
3739

3840
public function __invoke(DocumentParsedEvent $event): void
3941
{
4042
$document = $event->getDocument();
41-
$embeds = [];
43+
$embeds = [];
4244
foreach (new NodeIterator($document) as $node) {
4345
if (! ($node instanceof Embed)) {
4446
continue;
4547
}
4648

4749
if ($node->parent() !== $document) {
48-
$replacement = new Paragraph();
50+
$replacement = new Paragraph;
4951
$replacement->appendChild(new Text($node->getUrl()));
5052
$node->replaceWith($replacement);
5153
} else {
5254
$embeds[] = $node;
5355
}
5456
}
55-
info('EmbedProcessor::__invoke');
57+
info('EmbedProcessor::__invoke');
5658
$this->adapter->updateEmbeds($embeds);
5759

5860
foreach ($embeds as $embed) {
@@ -63,7 +65,7 @@ public function __invoke(DocumentParsedEvent $event): void
6365
if ($this->fallback === self::FALLBACK_REMOVE) {
6466
$embed->detach();
6567
} elseif ($this->fallback === self::FALLBACK_LINK) {
66-
$paragraph = new Paragraph();
68+
$paragraph = new Paragraph;
6769
$paragraph->appendChild(new Link($embed->getUrl(), $embed->getUrl()));
6870
$embed->replaceWith($paragraph);
6971
}

0 commit comments

Comments
 (0)