Presentable   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 32
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A present() 0 16 4
1
<?php
2
3
namespace Tequilarapido\Presenter;
4
5
trait Presentable
6
{
7
    /**
8
     * View presenter instance.
9
     *
10
     * @var mixed
11
     */
12
    protected $presenterInstance;
13
14
    /**
15
     * Prepare a new or cached presenter instance.
16
     *
17
     * @return mixed
18
     * @throws PresenterException
19
     */
20 4
    public function present()
21
    {
22 4
        if (! $this->presenter) {
0 ignored issues
show
Bug introduced by
The property presenter does not seem to exist. Did you mean presenterInstance?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
23 1
            throw new PresenterException('Please set the $presenter property to your presenter fully qualified class name.');
24
        }
25
26 3
        if (! class_exists($this->presenter)) {
0 ignored issues
show
Bug introduced by
The property presenter does not seem to exist. Did you mean presenterInstance?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
27 1
            throw new PresenterException('The presenter class ['.$this->presenter.'] does not exist.');
0 ignored issues
show
Bug introduced by
The property presenter does not seem to exist. Did you mean presenterInstance?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
28
        }
29
30 2
        if (! $this->presenterInstance) {
31 2
            $this->presenterInstance = new $this->presenter($this);
0 ignored issues
show
Bug introduced by
The property presenter does not seem to exist. Did you mean presenterInstance?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
32
        }
33
34 2
        return $this->presenterInstance;
35
    }
36
}
37