Completed
Push — master ( a19a47...15bbc5 )
by Arjay
15:59
created

WidgetPresenter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A class() 0 8 1
A template() 0 4 2
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