Passed
Push — master ( ba0945...7a8c26 )
by Stephen
57s queued 11s
created

CacheKey   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 3 1
A __construct() 0 4 2
1
<?php
2
3
namespace Sfneal\Helpers\Laravel\Support;
4
5
use Sfneal\Actions\AbstractAction;
6
7
class CacheKey extends AbstractAction
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