Theme   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A isDefault() 0 4 1
A preview() 0 4 1
1
<?php
2
3
namespace Yajra\CMS\Themes;
4
5
use Illuminate\Support\Fluent;
6
7
class Theme extends Fluent
8
{
9
    /**
10
     * @var string
11
     */
12
    public $name;
13
14
    /**
15
     * @var string
16
     */
17
    public $theme;
18
19
    /**
20
     * @var string
21
     */
22
    public $version;
23
24
    /**
25
     * @var string
26
     */
27
    public $description;
28
29
    /**
30
     * @var array
31
     */
32
    public $positions = [];
33
34
    /**
35
     * @var string
36
     */
37
    public $type;
38
39
    /**
40
     * Theme constructor.
41
     *
42
     * @param string $name
43
     * @param string $theme
44
     * @param string $type
45
     * @param string $version
46
     * @param string $description
47
     * @param array $positions
48
     * @param array|object $attributes
49
     */
50
    public function __construct($name, $theme, $type, $version, $description, array $positions, $attributes = [])
51
    {
52
        $this->name        = $name;
53
        $this->theme       = $theme;
54
        $this->type        = $type;
55
        $this->version     = $version;
56
        $this->description = $description;
57
        $this->positions   = $positions;
58
59
        parent::__construct($attributes);
60
    }
61
62
    /**
63
     * Check if this team is the default theme.
64
     *
65
     * @return bool
66
     */
67
    public function isDefault()
68
    {
69
        return $this->theme == config('themes.frontend', 'default');
70
    }
71
72
    /**
73
     * Get theme image preview url.
74
     *
75
     * @return \Illuminate\Contracts\Routing\UrlGenerator|string
76
     */
77
    public function preview()
78
    {
79
        return url('themes/' . $this->theme . '/preview.png');
80
    }
81
}
82