1 | <?php |
||
23 | class TenantAwarePathBuilder implements TenantAwarePathBuilderInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var TenantContextInterface |
||
27 | */ |
||
28 | protected $tenantContext; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $rootPath; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $latestRootPath; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $defaultRootPath; |
||
44 | |||
45 | /** |
||
46 | * Construct. |
||
47 | * |
||
48 | * @param TenantContextInterface $tenantContext Tenant context |
||
49 | * @param string $rootPath PHPCR root path (e.g. /swp) |
||
50 | */ |
||
51 | public function __construct(TenantContextInterface $tenantContext, $rootPath) |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function build($data, $context = null) |
||
65 | |||
66 | /** |
||
67 | * Absolutize path or paths based on current context when provided. |
||
68 | * |
||
69 | * @param string|array $data Path or array of paths |
||
70 | * @param string $context Path absolute context |
||
71 | * |
||
72 | * @return string|array Tenant aware paths |
||
73 | */ |
||
74 | protected function absolutize($data, $context = null) |
||
88 | |||
89 | /** |
||
90 | * Makes PHPCR tree root path to be tenant aware. |
||
91 | * |
||
92 | * When tenant is not available in tenant context it will resolve |
||
93 | * the tenant from current request. |
||
94 | */ |
||
95 | protected function makePathTenantAware() |
||
111 | |||
112 | private function absolutizePath($path, $context = null) |
||
124 | } |
||
125 |