ImagePresenter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A image() 0 13 3
1
<?php
2
3
namespace App\Libraries\Presenterable\Presenters;
4
5
class ImagePresenter extends Presenter
6
{
7
    /**
8
     * Generate path to image with size or just return path to image.
9
     * 
10
     * @param null $size (available sizes ('big', 'medium', 'small'))
11
     * @return string
12
     */
13
    public function image($size = null)
14
    {
15
        $image = $this->model->image;
16
17
        if(! empty($image))
18
            if(! is_null($size)) {
19
                list($pathName, $mime) = explode('.', $image);
20
21
                $image = sprintf('%s_%s.%s', $pathName, $size, $mime);
22
            }
23
24
        return $image;
25
    }
26
}