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

Cover::getConfig()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 11
nc 3
nop 0
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