Completed
Branch BUG/investigate-failed-currenc... (34b1a3)
by
unknown
27:17 queued 19:00
created

Domain   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A isCaffeinated() 0 4 1
A setCaffeinated() 0 5 3
A brandName() 0 4 1
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
/**
9
 * DomainBase Class
10
 * A container for all domain data related to Event Espresso Core
11
 *
12
 * @package EventEspresso\core\domain
13
 * @author  Brent Christensen
14
 * @since   4.9.44
15
 */
16
class Domain extends DomainBase implements CaffeinatedInterface
17
{
18
19
    /**
20
     * URL path component used to denote an API request
21
     */
22
    const API_NAMESPACE = 'ee/v';
23
24
    /**
25
     * Slug used for the context where a registration status is changed from a manual trigger in the Registration Admin
26
     * Page ui.
27
     */
28
    const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN
29
        = 'manual_registration_status_change_from_registration_admin';
30
31
    const CONTEXT_REGISTRATION_STATUS_CHANGE_REGISTRATION_ADMIN_NOTIFY
32
        = 'manual_registration_status_change_from_registration_admin_and_notify';
33
34
35
    /**
36
     * Whether or not EE core is the full premium version.
37
     * @since 4.9.59.p
38
     * @var bool
39
     */
40
    private $caffeinated;
41
42
43
    public function __construct(FilePath $plugin_file, Version $version)
44
    {
45
        parent::__construct($plugin_file, $version);
46
        $this->setCaffeinated();
47
    }
48
49
    /**
50
     * Whether or not EE core is the full premium version.
51
     * @since 4.9.59.p
52
     * @return bool
53
     */
54
    public function isCaffeinated()
55
    {
56
        return $this->caffeinated;
57
    }
58
59
60
    /**
61
     * Setter for $is_caffeinated property.
62
     * @since 4.9.59.p
63
     */
64
    private function setCaffeinated()
65
    {
66
        $this->caffeinated = (! defined('EE_DECAF') || EE_DECAF !== true)
67
            && is_readable($this->pluginPath() . 'caffeinated/brewing_regular.php');
68
    }
69
70
71
    /**
72
     * This should be used everywhere the Event Espresso brand name is referenced in public facing interfaces
73
     * to allow for filtering the brand.
74
     *
75
     * @return string
76
     */
77
    public static function brandName()
78
    {
79
        return (string) apply_filters('FHEE__EventEspresso_core_domain_Domain__brandName', 'Event Espresso');
80
    }
81
}
82