REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 2.08 KB
Close
/home/getspomw/royalsquad.us/vendor/league/commonmark/src/Extension/DefaultAttributes/ApplyDefaultAttributesProcessor.php
Text
Base64
<?php declare(strict_types=1); /* * This file is part of the league/commonmark package. * * (c) Colin O'Dell <colinodell@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\CommonMark\Extension\DefaultAttributes; use League\CommonMark\Event\DocumentParsedEvent; use League\CommonMark\Extension\Attributes\Util\AttributesHelper; use League\Config\ConfigurationAwareInterface; use League\Config\ConfigurationInterface; final class ApplyDefaultAttributesProcessor implements ConfigurationAwareInterface { private ConfigurationInterface $config; public function onDocumentParsed(DocumentParsedEvent $event): void { /** @var array<string, array<string, mixed>> $map */ $map = $this->config->get('default_attributes'); // Don't bother iterating if no default attributes are configured if (! $map) { return; } foreach ($event->getDocument()->iterator() as $node) { // Check to see if any default attributes were defined if (($attributesToApply = $map[\get_class($node)] ?? []) === []) { continue; } $newAttributes = []; foreach ($attributesToApply as $name => $value) { if (\is_callable($value)) { $value = $value($node); // Callables are allowed to return `null` indicating that no changes should be made if ($value !== null) { $newAttributes[$name] = $value; } } else { $newAttributes[$name] = $value; } } // Merge these attributes into the node if (\count($newAttributes) > 0) { $node->data->set('attributes', AttributesHelper::mergeAttributes($node, $newAttributes)); } } } public function setConfiguration(ConfigurationInterface $configuration): void { $this->config = $configuration; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ApplyDefaultAttributesProcessor.php
2.08 KB
lrw-rw-rw-
2025-09-17 06:53:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DefaultAttributesExtension.php
1.25 KB
lrw-rw-rw-
2025-09-17 06:53:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).