LocallyStoredImage::getLocalFileName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace Goose\Images;
4
5
/**
6
 * Locally Stored Images
7
 *
8
 * @package Goose\Images
9
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
10
 */
11
class LocallyStoredImage {
12
    /**
13
     * @param mixed[] $options
14
     */
15
    public function __construct($options = []) {
16
        foreach ($options as $key => $value) {
17
            $method = 'set' . ucfirst($key);
18
19
            if (method_exists($this, $method)) {
20
                call_user_func([$this, $method], $value);
21
            }
22
        }
23
    }
24
25
    /**
26
     * remove unnecessary tmp image files
27
     */
28
    public function __destruct() {
29
        unlink($this->getLocalFileName());
30
    }
31
    
32
    /** @var string */
33
    private $imgSrc = '';
34
35
    /**
36
     * @param string $imgSrc
37
     *
38
     * @return self
39
     */
40
    public function setImgSrc(string $imgSrc): self {
41
        $this->imgSrc = $imgSrc;
42
43
        return $this;
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getImgSrc(): string {
50
        return $this->imgSrc;
51
    }
52
53
    /** @var string */
54
    private $localFileName = '';
55
56
    /**
57
     * @param string $localFileName
58
     *
59
     * @return self
60
     */
61
    public function setLocalFileName(string $localFileName): self {
62
        $this->localFileName = $localFileName;
63
64
        return $this;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getLocalFileName(): string {
71
        return $this->localFileName;
72
    }
73
74
    /** @var string */
75
    private $linkhash = '';
76
77
    /**
78
     * @param string $linkhash
79
     *
80
     * @return self
81
     */
82
    public function setLinkhash(string $linkhash): self {
83
        $this->linkhash = $linkhash;
84
85
        return $this;
86
    }
87
88
    /**
89
     * @return string
90
     */
91
    public function getLinkhash(): string {
92
        return $this->linkhash;
93
    }
94
95
    /** @var int */
96
    private $bytes = 0;
97
98
    /**
99
     * @param int $bytes
100
     *
101
     * @return self
102
     */
103
    public function setBytes(int $bytes): self {
104
        $this->bytes = $bytes;
105
106
        return $this;
107
    }
108
109
    /**
110
     * @return int
111
     */
112
    public function getBytes(): int {
113
        return $this->bytes;
114
    }
115
116
    /** @var string */
117
    private $fileExtension = '';
118
119
    /**
120
     * @param string $fileExtension
121
     *
122
     * @return self
123
     */
124
    public function setFileExtension(string $fileExtension): self {
125
        $this->fileExtension = $fileExtension;
126
127
        return $this;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getFileExtension(): string {
134
        return $this->fileExtension;
135
    }
136
137
    /** @var int */
138
    private $height = 0;
139
140
    /**
141
     * @param int $height
142
     *
143
     * @return self
144
     */
145
    public function setHeight(int $height): self {
146
        $this->height = $height;
147
148
        return $this;
149
    }
150
151
    /**
152
     * @return int
153
     */
154
    public function getHeight(): int {
155
        return $this->height;
156
    }
157
158
    /** @var int */
159
    private $width = 0;
160
161
    /**
162
     * @param int $width
163
     *
164
     * @return self
165
     */
166
    public function setWidth(int $width): self {
167
        $this->width = $width;
168
169
        return $this;
170
    }
171
172
    /**
173
     * @return int
174
     */
175
    public function getWidth(): int {
176
        return $this->width;
177
    }
178
}
179