ImagePresentorPresentable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A cover() 0 13 2
1
<?php
2
3
namespace App\Libraries\Presenterable;
4
5
trait ImagePresentorPresentable
6
{
7
    /**
8
     * Cover image.
9
     * @to_work: Should use App\Libraries\Presenterable trait.
10
     *
11
     * @param string $order
12
     * @param null $size
13
     * @return mixed
14
     */
15
    public function cover($order = 'asc', $size = null, $default = null)
0 ignored issues
show
Unused Code introduced by
The parameter $default is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
    {
17
        $image = $this->model
0 ignored issues
show
Bug introduced by
The property model does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
18
            ->images()
19
            ->ranked($order)
20
            ->first();
21
22
        if($image)
23
            return $image->present()
24
                ->image($size);
25
26
        return '';
27
    }
28
}