-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathCompilerFactory.php
More file actions
30 lines (23 loc) · 763 Bytes
/
CompilerFactory.php
File metadata and controls
30 lines (23 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
declare(strict_types=1);
namespace Hypervel\View;
use Hyperf\Support\Filesystem\Filesystem;
use Hyperf\ViewEngine\Blade;
use Hypervel\View\Compilers\BladeCompiler;
use Psr\Container\ContainerInterface;
class CompilerFactory
{
public function __invoke(ContainerInterface $container)
{
$blade = new BladeCompiler(
$container->get(Filesystem::class),
Blade::config('config.cache_path')
);
// register view components
foreach ((array) Blade::config('components', []) as $alias => $class) {
$blade->component($class, $alias);
}
$blade->setComponentAutoload((array) Blade::config('autoload', ['classes' => [], 'components' => []]));
return $blade;
}
}