Skip to content

Commit 01da71f

Browse files
authored
[Tool] Add Frontend resolver (#116)
* add tool frontend resolver * update namespace
1 parent 4711112 commit 01da71f

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Tools;
15+
16+
use Pimcore\Model\Document;
17+
use Pimcore\Model\Site;
18+
use Pimcore\Tool\Frontend;
19+
20+
class FrontendResolverContract implements FrontendResolverContractInterface
21+
{
22+
public function isDocumentInSite(?Site $site, Document $document): bool
23+
{
24+
return Frontend::isDocumentInSite($site, $document);
25+
}
26+
27+
public function isDocumentInCurrentSite(Document $document): bool
28+
{
29+
return Frontend::isDocumentInCurrentSite($document);
30+
}
31+
32+
public function getSiteForDocument(Document $document): ?Site
33+
{
34+
return Frontend::getSiteForDocument($document);
35+
}
36+
37+
public function getSiteIdForDocument(Document $document): ?int
38+
{
39+
return Frontend::getSiteIdForDocument($document);
40+
}
41+
42+
/**
43+
* @return false|array{enabled: true, lifetime: int|null}
44+
*/
45+
public function isOutputCacheEnabled(): bool|array
46+
{
47+
return Frontend::isOutputCacheEnabled();
48+
}
49+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Tools;
15+
16+
use Pimcore\Model\Document;
17+
use Pimcore\Model\Site;
18+
19+
interface FrontendResolverContractInterface
20+
{
21+
public function isDocumentInSite(?Site $site, Document $document): bool;
22+
23+
public function isDocumentInCurrentSite(Document $document): bool;
24+
25+
public function getSiteForDocument(Document $document): ?Site;
26+
27+
public function getSiteIdForDocument(Document $document): ?int;
28+
29+
/**
30+
* @return false|array{enabled: true, lifetime: int|null}
31+
*/
32+
public function isOutputCacheEnabled(): bool|array;
33+
}

src/Lib/Tools/FrontendResolver.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StaticResolverBundle\Lib\Tools;
15+
16+
use Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Tools\FrontendResolverContract;
17+
18+
/**
19+
* @internal
20+
*/
21+
final class FrontendResolver extends FrontendResolverContract implements FrontendResolverInterface
22+
{
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StaticResolverBundle\Lib\Tools;
15+
16+
use Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Tools\FrontendResolverContractInterface;
17+
18+
/**
19+
* @internal
20+
*/
21+
interface FrontendResolverInterface extends FrontendResolverContractInterface
22+
{
23+
}

0 commit comments

Comments
 (0)