Completed
Branch BUG/11268/session-ticket-relea... (71e39e)
by
unknown
25:05 queued 12:44
created

DomainBase::distributionAssetsUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain;
4
5
use EventEspresso\core\domain\values\FilePath;
6
use EventEspresso\core\domain\values\Version;
7
8
defined('EVENT_ESPRESSO_VERSION') || exit('No direct access allowed');
9
10
11
/**
12
 * DomainBase Class
13
 * A container for all domain data related to the plugin
14
 *
15
 * @package EventEspresso\core\domain
16
 * @author  Darren Ethier
17
 * @since   4.9.38
18
 */
19
abstract class DomainBase implements DomainInterface
20
{
21
22
    /**
23
     * Equivalent to `__FILE__` for main plugin file.
24
     *
25
     * @var FilePath
26
     */
27
    private $plugin_file;
28
29
    /**
30
     * String indicating version for plugin
31
     *
32
     * @var string
33
     */
34
    private $version;
35
36
    /**
37
     * @var string $plugin_basename
38
     */
39
    private $plugin_basename;
40
41
    /**
42
     * @var string $plugin_path
43
     */
44
    private $plugin_path;
45
46
    /**
47
     * @var string $plugin_url
48
     */
49
    private $plugin_url;
50
51
52
53
    /**
54
     * Initializes internal properties.
55
     *
56
     * @param FilePath $plugin_file
57
     * @param Version  $version
58
     */
59
    public function __construct(FilePath $plugin_file, Version $version)
60
    {
61
        $this->plugin_file = $plugin_file;
62
        $this->version = $version;
63
        $this->plugin_basename = plugin_basename($this->pluginFile());
64
        $this->plugin_path = plugin_dir_path($this->pluginFile());
65
        $this->plugin_url = plugin_dir_url($this->pluginFile());
66
    }
67
68
69
    /**
70
     * @return string
71
     */
72
    public function pluginFile()
73
    {
74
        return (string) $this->plugin_file;
75
    }
76
77
78
79
    /**
80
     * @return string
81
     */
82
    public function pluginBasename()
83
    {
84
        return $this->plugin_basename;
85
    }
86
87
88
89
    /**
90
     * @return string
91
     */
92
    public function pluginPath()
93
    {
94
        return $this->plugin_path;
95
    }
96
97
98
99
    /**
100
     * @return string
101
     */
102
    public function pluginUrl()
103
    {
104
        return $this->plugin_url;
105
    }
106
107
108
109
    /**
110
     * @return string
111
     */
112
    public function version()
113
    {
114
        return (string) $this->version;
115
    }
116
117
118
119
    /**
120
     * @return Version
121
     */
122
    public function versionValueObject()
123
    {
124
        return $this->version;
125
    }
126
127
128
    /**
129
     * @return string
130
     */
131
    public function distributionAssetsPath()
132
    {
133
        return $this->pluginPath() . 'assets/dist/';
134
    }
135
136
137
    /**
138
     * @return string
139
     */
140
    public function distributionAssetsUrl()
141
    {
142
        return $this->pluginUrl() . 'assets/dist/';
143
    }
144
}
145