ImageHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 22
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUrl() 0 7 2
1
<?php
2
/**
3
 * @link https://github.com/yiimaker/yii2-banner
4
 * @copyright Copyright (c) 2017 Yii Maker
5
 * @license BSD 3-Clause License
6
 */
7
8
namespace ymaker\banner\common\helpers;
9
10
use Yii;
11
use ymaker\banner\common\components\FileManagerInterface;
12
13
/**
14
 * Helper for banner images.
15
 *
16
 * @author Vladimir Kuprienko <[email protected]>
17
 * @since 1.0
18
 */
19
class ImageHelper
20
{
21
    /**
22
     * @var FileManagerInterface
23
     */
24
    private static $_fileManager;
25
26
27
    /**
28
     * Returns URL to image.
29
     *
30
     * @param string $fileName
31
     * @return string
32
     */
33
    public static function getUrl($fileName)
34
    {
35
        if (self::$_fileManager === null) {
36
            self::$_fileManager = Yii::$container->get(FileManagerInterface::class);
37
        }
38
        return self::$_fileManager->getImageUrl($fileName);
39
    }
40
}
41