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

DownscaleFilterLoader::load()   B

Complexity

Conditions 4
Paths 3

Size

Total Lines 25
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 25
rs 8.5806
cc 4
eloc 14
nc 3
nop 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A DownscaleFilterLoader::isImageProcessable() 0 4 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