Skip to content

Commit c22bec0

Browse files
linawolfjaapio
authored andcommitted
[TASK] Make Markdown a proper extension with DI
1 parent d77ceb5 commit c22bec0

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
6+
7+
return static function (ContainerConfigurator $container): void {
8+
$container->services()
9+
->defaults()
10+
->autowire()
11+
->autoconfigure();
12+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace phpDocumentor\Guides\Markdown\DependencyInjection;
6+
7+
use Symfony\Component\Config\FileLocator;
8+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9+
use Symfony\Component\DependencyInjection\ContainerBuilder;
10+
use Symfony\Component\DependencyInjection\Extension\Extension;
11+
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
12+
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
13+
14+
use function dirname;
15+
16+
class MarkdownExtension extends Extension implements PrependExtensionInterface, CompilerPassInterface
17+
{
18+
/** @param mixed[] $configs */
19+
public function load(array $configs, ContainerBuilder $container): void
20+
{
21+
$loader = new PhpFileLoader(
22+
$container,
23+
new FileLocator(dirname(__DIR__, 3) . '/resources/config'),
24+
);
25+
26+
$loader->load('guides-markdown.php');
27+
}
28+
29+
public function prepend(ContainerBuilder $container): void
30+
{
31+
}
32+
33+
public function process(ContainerBuilder $container): void
34+
{
35+
}
36+
}

0 commit comments

Comments
 (0)