Completed
Push — master ( 319645...655917 )
by Lukas Kahwe
14s
created

DownscaleFilterLoader::isImageProcessable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Liip\ImagineBundle\Imagine\Filter\Loader;
4
5
/**
6
 * Downscale filter.
7
 *
8
 * @author Devi Prasad <https://github.com/deviprsd21>
9
 */
10
class DownscaleFilterLoader extends ScaleFilterLoader
11
{
12
    public function __construct()
13
    {
14
        parent::__construct('max', 'by', false);
15
    }
16
17
    protected function calcAbsoluteRatio($ratio)
18
    {
19
        return 1 - ($ratio > 1 ? $ratio - floor($ratio) : $ratio);
20
    }
21
22
    protected function isImageProcessable($ratio)
23
    {
24
        return $ratio < 1;
25
    }
26
}
27