CacheKey::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Sfneal\Helpers\Laravel\Support;
4
5
use Sfneal\Actions\Action;
6
7
class CacheKey extends Action
8
{
9
    /**
10
     * @var string
11
     */
12
    private $item;
13
14
    /**
15
     * @var string|null
16
     */
17
    private $identifier;
18
19
    /**
20
     * CacheKey constructor.
21
     *
22
     * @param  string  $item
23
     * @param  string|null  $identifier
24
     */
25
    public function __construct(string $item, string $identifier = null)
26
    {
27
        $this->item = $item;
28
        $this->identifier = (isset($identifier) ? ':'.$identifier : '');
29
    }
30
31
    /**
32
     * Retrieve a cache key for a particular service item.
33
     *
34
     * @return string
35
     */
36
    public function execute(): string
37
    {
38
        return config('app-info.cache_prefix').':'.$this->item.$this->identifier;
39
    }
40
}
41