Code Duplication    Length = 19-19 lines in 2 locations

lib/Ajde/Resource/Image.php 2 locations

@@ 216-234 (lines=19) @@
213
        return ($this->getHeight() >= $this->getWidth()) ? self::ORIENTATION_PORTRAIT : self::ORIENTATION_LANDSCAPE;
214
    }
215
216
    public function getHeight($calculate = true)
217
    {
218
        if ($this->has('height') && !$this->isEmpty('height')) {
219
            return $this->get('height');
220
        } else {
221
            if ($calculate === true) {
222
                $old_y = imagesy($this->getImageResource());
223
                if ($this->has('width') && !$this->isEmpty('width')) {
224
                    $old_x = imagesx($this->getImageResource());
225
226
                    return (int) (($old_y / $old_x) * $this->get('width'));
227
                } else {
228
                    return $old_y;
229
                }
230
            }
231
        }
232
233
        return 0;
234
    }
235
236
    public function getWidth($calculate = true)
237
    {
@@ 236-254 (lines=19) @@
233
        return 0;
234
    }
235
236
    public function getWidth($calculate = true)
237
    {
238
        if ($this->has('width') && !$this->isEmpty('width')) {
239
            return $this->get('width');
240
        } else {
241
            if ($calculate === true) {
242
                $old_x = imagesx($this->getImageResource());
243
                if ($this->has('height') && !$this->isEmpty('height')) {
244
                    $old_y = imagesy($this->getImageResource());
245
246
                    return (int) (($old_x / $old_y) * $this->get('height'));
247
                } else {
248
                    return $old_x;
249
                }
250
            }
251
        }
252
253
        return 0;
254
    }
255
256
    public function resize($height, $width, $crop = true, $xCorrection = 0, $yCorrection = 0)
257
    {