Completed
Push — ezp26297-rest_embedding_http_c... ( 123323 )
by
unknown
80:28 queued 54:58
created

AbstractController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCacheTagsForContentInfo() 0 8 1
A getCacheTagsForLocation() 0 9 1
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
namespace eZ\Publish\Core\REST\Server\HttpCache\Controller;
7
8
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
9
use eZ\Publish\API\Repository\Values\Content\Location;
10
11
abstract class AbstractController
12
{
13
    protected function getCacheTagsForContentInfo(ContentInfo $contentInfo)
14
    {
15
        return [
16
            'content' => $contentInfo->id,
17
            'location' => $contentInfo->mainLocationId,
18
            'content-type' => $contentInfo->contentTypeId,
19
        ];
20
    }
21
22
    protected function getCacheTagsForLocation(Location $location)
23
    {
24
        return [
25
            'location' => $location->id,
26
            'content' => $location->contentInfo->id,
27
            'content-type' => $location->contentInfo->contentTypeId,
28
            'path' => $location->path
29
        ];
30
    }
31
32
}
33