• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

liip / LiipImagineBundle / 10701363663

04 Sep 2024 12:11PM UTC coverage: 81.688% (-0.06%) from 81.746%
10701363663

push

github

web-flow
Merge pull request #1610 from liip/cs-fix

apply latest cs fixer

67 of 84 new or added lines in 42 files covered. (79.76%)

2 existing lines in 1 file now uncovered.

2275 of 2785 relevant lines covered (81.69%)

103.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Imagine/Filter/RelativeResize.php
1
<?php
2

3
/*
4
 * This file is part of the `liip/LiipImagineBundle` project.
5
 *
6
 * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11

12
namespace Liip\ImagineBundle\Imagine\Filter;
13

14
use Imagine\Exception\InvalidArgumentException;
15
use Imagine\Filter\FilterInterface;
16
use Imagine\Image\ImageInterface;
17

18
/**
19
 * Filter for resizing an image relative to its existing dimensions.
20
 *
21
 * @author Jeremy Mikola <jmikola@gmail.com>
22
 */
23
class RelativeResize implements FilterInterface
24
{
25
    private $method;
26
    private $parameter;
27

28
    /**
29
     * Constructs a RelativeResize filter with the given method and argument.
30
     *
31
     * @param string $method    BoxInterface method
32
     * @param mixed  $parameter Parameter for BoxInterface method
33
     *
34
     * @throws InvalidArgumentException
35
     */
36
    public function __construct($method, $parameter)
37
    {
38
        if (!\in_array($method, ['heighten', 'increase', 'scale', 'widen'], true)) {
×
NEW
39
            throw new InvalidArgumentException(\sprintf('Unsupported method: %s', $method));
×
40
        }
41

42
        $this->method = $method;
×
43
        $this->parameter = $parameter;
×
44
    }
45

46
    public function apply(ImageInterface $image)
47
    {
48
        return $image->resize(\call_user_func([$image->getSize(), $this->method], $this->parameter));
×
49
    }
50
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc