forked from ezsystems/PlatformUIBundle
/
RootInfo.php
35 lines (30 loc) · 1.06 KB
/
RootInfo.php
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
31
32
33
34
35
<?php
/**
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace EzSystems\PlatformUIBundle\ApplicationConfig\Providers;
use EzSystems\PlatformUIBundle\ApplicationConfig\Provider;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper;
use Symfony\Component\HttpFoundation\RequestStack;
class RootInfo implements Provider
{
/** @var \Symfony\Component\HttpFoundation\RequestStack */
private $requestStack;
/** @var \Symfony\Component\Templating\Asset\PackageInterface */
private $assetsHelper;
public function __construct(RequestStack $requestStack, AssetsHelper $assetsHelper)
{
$this->requestStack = $requestStack;
$this->assetsHelper = $assetsHelper;
}
/**
* @return array|string|int|\JsonSerializable
*/
public function getConfig()
{
return [
'root' => $this->requestStack->getMasterRequest()->attributes->get('semanticPathInfo'),
'assetRoot' => $this->assetsHelper->getUrl('/'),
];
}
}