Completed
Push — master ( c4a686...2e0334 )
by Arjay
11:39
created

FileAssetCacheRepository::strParser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Yajra\CMS\Repositories\FileAsset;
4
5
use Illuminate\Contracts\Cache\Repository as Cache;
6
7 View Code Duplication
class FileAssetCacheRepository implements FileAssetRepository
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /**
10
     * @var \Yajra\CMS\Repositories\FileAsset\FileAssetRepository
11
     */
12
    private $repository;
13
14
    /**
15
     * @var \Illuminate\Contracts\Cache\Repository
16
     */
17
    private $cache;
18
19
    /**
20
     * FileAssetCacheRepository constructor.
21
     *
22
     * @param \Yajra\CMS\Repositories\FileAsset\FileAssetRepository $repository
23
     * @param \Illuminate\Contracts\Cache\Repository $cache
24
     */
25
    public function __construct(FileAssetRepository $repository, Cache $cache)
26
    {
27
        $this->repository = $repository;
28
        $this->cache      = $cache;
29
    }
30
31
    /**
32
     * Get all file assets.
33
     *
34
     * @return \Illuminate\Database\Eloquent\Collection|static[]
35
     */
36
    public function all()
37
    {
38
        return $this->cache->rememberForever('fileAssets.all', function () {
39
            return $this->repository->all();
40
        });
41
    }
42
43
    /**
44
     * Register admin required assets.
45
     */
46
    public function registerAdminRequireAssets()
47
    {
48
        return $this->repository->registerAdminRequireAssets();
49
    }
50
51
    /**
52
     * Get file asset by name.
53
     *
54
     * @param string $name
55
     * @param null $category
56
     * @return \Yajra\CMS\Repositories\FileAsset\FileAsset
57
     */
58
    public function getByName($name, $category = null)
59
    {
60
        return $this->repository->getByName($name, $category);
61
    }
62
63
    /**
64
     * Add site asset.
65
     *
66
     * @param string $type
67
     * @return \Roumen\Asset\Asset;
0 ignored issues
show
Documentation introduced by
The doc-type \Roumen\Asset\Asset; could not be parsed: Expected "|" or "end of type", but got ";" at position 19. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
68
     */
69
    public function addAsset($type)
70
    {
71
        return $this->repository->addAsset($type);
72
    }
73
}