Passed
Push — master ( e515a3...13e6ec )
by Vladimir
02:11
created

Fit   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 10 3
1
<?php
2
/**
3
 * @link https://github.com/Vintage-web-production/yii2-tinify
4
 * @copyright Copyright (c) 2017 Vintage Web Production
5
 * @license BSD 3-Clause License
6
 */
7
8
namespace vintage\tinify\algorithms;
9
10
use yii\base\InvalidConfigException;
11
12
/**
13
 * Fit image algorithm.
14
 *
15
 * @author Vladimir Kuprienko <[email protected]>
16
 * @since 1.1
17
 */
18
class Fit extends AbstractAlgorithm
19
{
20
    /**
21
     * @inheritdoc
22
     */
23
    public function getConfig()
24
    {
25
        if (empty($this->width) && empty($this->height)) {
26
            throw new InvalidConfigException(
27
                'For "' . self::className() . '" algorithm you should to set a "width" and "height"'
28
            );
29
        }
30
        return [
31
            'width' => $this->width,
32
            'height' => $this->height,
33
        ];
34
    }
35
}
36