Completed
Push — master ( 515139...fcdc06 )
by Dan Michael O.
19:00
created

CachedImage::store()   C

Complexity

Conditions 7
Paths 13

Size

Total Lines 33
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 33
rs 6.7272
cc 7
eloc 19
nc 13
nop 1
1
<?php
2
3
namespace Colligator;
4
5
use Intervention\Image\Image;
6
use Intervention\Image\ImageManager;
7
use League\Flysystem\AdapterInterface;
8
use League\Flysystem\Config as FlysystemConfig;
9
10
class CachedImage
11
{
12
    public $sourceUrl;
13
    public $maxHeight;
14
    public $cacheKey;
15
    protected $_metadata;
16
    protected $coverCache;
17
18
    public function __construct(CoverCache $coverCache, $cacheKey)
19
    {
20
        $this->coverCache = $coverCache;
21
        $this->cacheKey = $cacheKey;
22
    }
23
24
25
    public function getMetadata()
26
    {
27
        if (is_null($this->_metadata)) {
28
            $this->_metadata = $this->coverCache->getMetadata($this->cacheKey);
29
        }
30
31
        return $this->_metadata;
32
    }
33
34
    public function width()
35
    {
36
        return $this->getMetadata()['width'];
37
    }
38
39
    public function height()
40
    {
41
        return $this->getMetadata()['height'];
42
    }
43
44
    public function mime()
45
    {
46
        return $this->getMetadata()['mime'];
47
    }
48
49
    public function size()
50
    {
51
        return $this->getMetadata()['size'];
52
    }
53
}
54