WidgetPresenter::template()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yajra\CMS\Presenters;
4
5
use Laracasts\Presenter\Presenter;
6
7
class WidgetPresenter extends Presenter
8
{
9
    /**
10
     * Get widget's view template.
11
     *
12
     * @return string
13
     */
14
    public function template()
15
    {
16
        return $this->entity->template === 'custom' ? $this->entity->custom_template : $this->entity->template;
17
    }
18
19
    /**
20
     * Get widget type FQCN.
21
     *
22
     * @return string
23
     * @throws \Exception
24
     */
25
    public function class()
0 ignored issues
show
Coding Style introduced by
Possible parse error: non-abstract method defined as abstract
Loading history...
26
    {
27
        /** @var \Yajra\CMS\Repositories\Extension\Repository $repository */
28
        $repository = app('extensions');
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $repository.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
29
        $extension  = $repository->findOrFail($this->entity->extension_id);
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
Coding Style introduced by
The visibility should be declared for property $extension.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
30
31
        return $extension->param('class');
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $extension.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
32
    }
33
}
34