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

Cover   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 14 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
/**
11
 * Cover image algorithm.
12
 *
13
 * @author Vladimir Kuprienko <[email protected]>
14
 * @since 1.1
15
 */
16
class Cover extends AbstractAlgorithm
17
{
18
    /**
19
     * @inheritdoc
20
     */
21
    public function getConfig()
22
    {
23
        $config = [];
24
        if (empty($this->width)) {
25
            $config['width'] = $this->height;
26
            $config['height'] = $this->height;
27
        } elseif (empty($this->height)) {
28
            $config['width'] = $this->width;
29
            $config['height'] = $this->width;
30
        } else {
31
            $config['width'] = $this->width;
32
            $config['height'] = $this->height;
33
        }
34
        return $config;
35
    }
36
}
37