Completed
Push — master ( 613b03...399412 )
by Stefano
16s queued 12s
created

CacheTools   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 3
c 0
b 0
f 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A cacheKey() 0 5 1
1
<?php
2
/**
3
 * BEdita, API-first content management framework
4
 * Copyright 2021 ChannelWeb Srl, Chialab Srl
5
 *
6
 * This file is part of BEdita: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as published
8
 * by the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * See LICENSE.LGPL or <http://gnu.org/licenses/lgpl-3.0.html> for more details.
12
 */
13
14
namespace App\Utility;
15
16
use BEdita\WebTools\ApiClientProvider;
17
18
/**
19
 * Add cache related utility methods
20
 */
21
class CacheTools
22
{
23
    /**
24
     * Create multi project cache key.
25
     *
26
     * @param string $name Cache item name.
27
     * @return string
28
     */
29
    public static function cacheKey(string $name): string
30
    {
31
        $apiSignature = md5(ApiClientProvider::getApiClient()->getApiBaseUrl());
32
33
        return sprintf('%s_%s', $name, $apiSignature);
34
    }
35
}
36