Completed
Push — master ( 7a1e6c...8794c3 )
by Arjay
11:28
created

FileAssetCacheRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
cc 1
eloc 3
nc 1
nop 2
rs 9.4285
1
<?php
2
3
namespace Yajra\CMS\Repositories\FileAsset;
4
5
use Illuminate\Contracts\Cache\Repository as Cache;
6
7
class FileAssetCacheRepository implements FileAssetRepository
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
     * @return FileAsset
56
     */
57
    public function getByName($name)
58
    {
59
        return $this->repository->getByName($name);
60
    }
61
62
    /**
63
     * Register css blade directive.
64
     */
65
    public function registerCssBlade()
66
    {
67
        return $this->repository->registerCssBlade();
68
    }
69
70
    /**
71
     * Register javascript blade directive.
72
     */
73
    public function registerJsBlade()
74
    {
75
        return $this->repository->registerJsBlade();
76
    }
77
78
    /**
79
     * Add site asset.
80
     *
81
     * @param string $type
82
     * @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...
83
     */
84
    public function addAsset($type)
85
    {
86
        return $this->repository->addAsset($type);
87
    }
88
}