Completed
Branch dependabot/npm_and_yarn/mini-c... (07d443)
by
unknown
09:52 queued 07:53
created
core/services/collections/DuplicateCollectionIdentifierException.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,25 +16,25 @@
 block discarded – undo
16 16
 class DuplicateCollectionIdentifierException extends OutOfRangeException
17 17
 {
18 18
 
19
-    /**
20
-     * DuplicateCollectionIdentifierException constructor.
21
-     *
22
-     * @param                $identifier
23
-     * @param string         $message
24
-     * @param int            $code
25
-     * @param Exception|null $previous
26
-     */
27
-    public function __construct($identifier, $message = '', $code = 0, Exception $previous = null)
28
-    {
29
-        if (empty($message)) {
30
-            $message = sprintf(
31
-                __(
32
-                    'The supplied identifier "%1$s" already exists within this collection.',
33
-                    'event_espresso'
34
-                ),
35
-                $identifier
36
-            );
37
-        }
38
-        parent::__construct($message, $code, $previous);
39
-    }
19
+	/**
20
+	 * DuplicateCollectionIdentifierException constructor.
21
+	 *
22
+	 * @param                $identifier
23
+	 * @param string         $message
24
+	 * @param int            $code
25
+	 * @param Exception|null $previous
26
+	 */
27
+	public function __construct($identifier, $message = '', $code = 0, Exception $previous = null)
28
+	{
29
+		if (empty($message)) {
30
+			$message = sprintf(
31
+				__(
32
+					'The supplied identifier "%1$s" already exists within this collection.',
33
+					'event_espresso'
34
+				),
35
+				$identifier
36
+			);
37
+		}
38
+		parent::__construct($message, $code, $previous);
39
+	}
40 40
 }
Please login to merge, or discard this patch.
core/exceptions/InvalidIdentifierException.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,28 +16,28 @@
 block discarded – undo
16 16
 class InvalidIdentifierException extends InvalidArgumentException
17 17
 {
18 18
 
19
-    /**
20
-     * InvalidIdentifierException constructor.
21
-     *
22
-     * @param string     $actual   the identifier that was supplied
23
-     * @param string     $expected example of an acceptable identifier
24
-     * @param string     $message
25
-     * @param int        $code
26
-     * @param Exception $previous
27
-     */
28
-    public function __construct($actual, $expected, $message = '', $code = 0, Exception $previous = null)
29
-    {
30
-        if (empty($message)) {
31
-            $message = sprintf(
32
-                __(
33
-                    'The supplied identifier "%1$s" is invalid. A value like "%2$s" was expected.',
34
-                    'event_espresso'
35
-                ),
36
-                $actual,
37
-                $expected
38
-            );
39
-        }
40
-        parent::__construct($message, $code, $previous);
41
-    }
19
+	/**
20
+	 * InvalidIdentifierException constructor.
21
+	 *
22
+	 * @param string     $actual   the identifier that was supplied
23
+	 * @param string     $expected example of an acceptable identifier
24
+	 * @param string     $message
25
+	 * @param int        $code
26
+	 * @param Exception $previous
27
+	 */
28
+	public function __construct($actual, $expected, $message = '', $code = 0, Exception $previous = null)
29
+	{
30
+		if (empty($message)) {
31
+			$message = sprintf(
32
+				__(
33
+					'The supplied identifier "%1$s" is invalid. A value like "%2$s" was expected.',
34
+					'event_espresso'
35
+				),
36
+				$actual,
37
+				$expected
38
+			);
39
+		}
40
+		parent::__construct($message, $code, $previous);
41
+	}
42 42
 }
43 43
 // Location: core/exceptions/InvalidIdentifierException.php
Please login to merge, or discard this patch.
core/domain/DomainBase.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function distributionAssetsPath()
138 138
     {
139
-        return $this->pluginPath() . 'assets/dist/';
139
+        return $this->pluginPath().'assets/dist/';
140 140
     }
141 141
 
142 142
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function distributionAssetsUrl()
147 147
     {
148
-        return $this->pluginUrl() . 'assets/dist/';
148
+        return $this->pluginUrl().'assets/dist/';
149 149
     }
150 150
 
151 151
 
Please login to merge, or discard this patch.
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -16,153 +16,153 @@
 block discarded – undo
16 16
 abstract class DomainBase implements DomainInterface
17 17
 {
18 18
 
19
-    /**
20
-     * Equivalent to `__FILE__` for main plugin file.
21
-     *
22
-     * @var FilePath
23
-     */
24
-    private $plugin_file;
25
-
26
-    /**
27
-     * String indicating version for plugin
28
-     *
29
-     * @var string
30
-     */
31
-    private $version;
32
-
33
-    /**
34
-     * @var string $plugin_basename
35
-     */
36
-    private $plugin_basename;
37
-
38
-    /**
39
-     * @var string $plugin_path
40
-     */
41
-    private $plugin_path;
42
-
43
-    /**
44
-     * @var string $plugin_url
45
-     */
46
-    private $plugin_url;
47
-
48
-    /**
49
-     * @var string $asset_namespace
50
-     */
51
-    private $asset_namespace;
52
-
53
-
54
-
55
-    /**
56
-     * Initializes internal properties.
57
-     *
58
-     * @param FilePath $plugin_file
59
-     * @param Version  $version
60
-     */
61
-    public function __construct(FilePath $plugin_file, Version $version)
62
-    {
63
-        $this->plugin_file = $plugin_file;
64
-        $this->version = $version;
65
-        $this->plugin_basename = plugin_basename($this->pluginFile());
66
-        $this->plugin_path = plugin_dir_path($this->pluginFile());
67
-        $this->plugin_url = plugin_dir_url($this->pluginFile());
68
-        $this->setAssetNamespace();
69
-    }
70
-
71
-
72
-    /**
73
-     * @return string
74
-     */
75
-    public function pluginFile()
76
-    {
77
-        return (string) $this->plugin_file;
78
-    }
79
-
80
-
81
-
82
-    /**
83
-     * @return string
84
-     */
85
-    public function pluginBasename()
86
-    {
87
-        return $this->plugin_basename;
88
-    }
89
-
90
-
91
-
92
-    /**
93
-     * @return string
94
-     */
95
-    public function pluginPath()
96
-    {
97
-        return $this->plugin_path;
98
-    }
99
-
100
-
101
-
102
-    /**
103
-     * @return string
104
-     */
105
-    public function pluginUrl()
106
-    {
107
-        return $this->plugin_url;
108
-    }
109
-
110
-
111
-
112
-    /**
113
-     * @return string
114
-     */
115
-    public function version()
116
-    {
117
-        return (string) $this->version;
118
-    }
119
-
120
-
121
-
122
-    /**
123
-     * @return Version
124
-     */
125
-    public function versionValueObject()
126
-    {
127
-        return $this->version;
128
-    }
129
-
130
-
131
-    /**
132
-     * @return string
133
-     */
134
-    public function distributionAssetsPath()
135
-    {
136
-        return $this->pluginPath() . 'assets/dist/';
137
-    }
138
-
139
-
140
-    /**
141
-     * @return string
142
-     */
143
-    public function distributionAssetsUrl()
144
-    {
145
-        return $this->pluginUrl() . 'assets/dist/';
146
-    }
147
-
148
-
149
-    /**
150
-     * @return string
151
-     */
152
-    public function assetNamespace()
153
-    {
154
-        return $this->asset_namespace;
155
-    }
156
-
157
-
158
-    /**
159
-     * @return void
160
-     */
161
-    private function setAssetNamespace()
162
-    {
163
-        $this->asset_namespace = sanitize_key(
164
-            // convert directory separators to dashes and remove file extension
165
-            str_replace(array('/', '.php'), array('-', ''), $this->plugin_basename)
166
-        );
167
-    }
19
+	/**
20
+	 * Equivalent to `__FILE__` for main plugin file.
21
+	 *
22
+	 * @var FilePath
23
+	 */
24
+	private $plugin_file;
25
+
26
+	/**
27
+	 * String indicating version for plugin
28
+	 *
29
+	 * @var string
30
+	 */
31
+	private $version;
32
+
33
+	/**
34
+	 * @var string $plugin_basename
35
+	 */
36
+	private $plugin_basename;
37
+
38
+	/**
39
+	 * @var string $plugin_path
40
+	 */
41
+	private $plugin_path;
42
+
43
+	/**
44
+	 * @var string $plugin_url
45
+	 */
46
+	private $plugin_url;
47
+
48
+	/**
49
+	 * @var string $asset_namespace
50
+	 */
51
+	private $asset_namespace;
52
+
53
+
54
+
55
+	/**
56
+	 * Initializes internal properties.
57
+	 *
58
+	 * @param FilePath $plugin_file
59
+	 * @param Version  $version
60
+	 */
61
+	public function __construct(FilePath $plugin_file, Version $version)
62
+	{
63
+		$this->plugin_file = $plugin_file;
64
+		$this->version = $version;
65
+		$this->plugin_basename = plugin_basename($this->pluginFile());
66
+		$this->plugin_path = plugin_dir_path($this->pluginFile());
67
+		$this->plugin_url = plugin_dir_url($this->pluginFile());
68
+		$this->setAssetNamespace();
69
+	}
70
+
71
+
72
+	/**
73
+	 * @return string
74
+	 */
75
+	public function pluginFile()
76
+	{
77
+		return (string) $this->plugin_file;
78
+	}
79
+
80
+
81
+
82
+	/**
83
+	 * @return string
84
+	 */
85
+	public function pluginBasename()
86
+	{
87
+		return $this->plugin_basename;
88
+	}
89
+
90
+
91
+
92
+	/**
93
+	 * @return string
94
+	 */
95
+	public function pluginPath()
96
+	{
97
+		return $this->plugin_path;
98
+	}
99
+
100
+
101
+
102
+	/**
103
+	 * @return string
104
+	 */
105
+	public function pluginUrl()
106
+	{
107
+		return $this->plugin_url;
108
+	}
109
+
110
+
111
+
112
+	/**
113
+	 * @return string
114
+	 */
115
+	public function version()
116
+	{
117
+		return (string) $this->version;
118
+	}
119
+
120
+
121
+
122
+	/**
123
+	 * @return Version
124
+	 */
125
+	public function versionValueObject()
126
+	{
127
+		return $this->version;
128
+	}
129
+
130
+
131
+	/**
132
+	 * @return string
133
+	 */
134
+	public function distributionAssetsPath()
135
+	{
136
+		return $this->pluginPath() . 'assets/dist/';
137
+	}
138
+
139
+
140
+	/**
141
+	 * @return string
142
+	 */
143
+	public function distributionAssetsUrl()
144
+	{
145
+		return $this->pluginUrl() . 'assets/dist/';
146
+	}
147
+
148
+
149
+	/**
150
+	 * @return string
151
+	 */
152
+	public function assetNamespace()
153
+	{
154
+		return $this->asset_namespace;
155
+	}
156
+
157
+
158
+	/**
159
+	 * @return void
160
+	 */
161
+	private function setAssetNamespace()
162
+	{
163
+		$this->asset_namespace = sanitize_key(
164
+			// convert directory separators to dashes and remove file extension
165
+			str_replace(array('/', '.php'), array('-', ''), $this->plugin_basename)
166
+		);
167
+	}
168 168
 }
Please login to merge, or discard this patch.
core/domain/values/assets/ManifestFile.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,26 +16,26 @@
 block discarded – undo
16 16
 class ManifestFile extends Asset
17 17
 {
18 18
 
19
-    /**
20
-     * Asset constructor.
21
-     *
22
-     * @param DomainInterface $domain
23
-     * @throws InvalidDataTypeException
24
-     */
25
-    public function __construct(DomainInterface $domain)
26
-    {
27
-        parent::__construct(Asset::TYPE_MANIFEST, $domain->assetNamespace(), $domain);
28
-    }
29
-
30
-
31
-    public function urlBase()
32
-    {
33
-        return $this->domain->distributionAssetsUrl();
34
-    }
35
-
36
-
37
-    public function filepath()
38
-    {
39
-        return $this->domain->distributionAssetsPath();
40
-    }
19
+	/**
20
+	 * Asset constructor.
21
+	 *
22
+	 * @param DomainInterface $domain
23
+	 * @throws InvalidDataTypeException
24
+	 */
25
+	public function __construct(DomainInterface $domain)
26
+	{
27
+		parent::__construct(Asset::TYPE_MANIFEST, $domain->assetNamespace(), $domain);
28
+	}
29
+
30
+
31
+	public function urlBase()
32
+	{
33
+		return $this->domain->distributionAssetsUrl();
34
+	}
35
+
36
+
37
+	public function filepath()
38
+	{
39
+		return $this->domain->distributionAssetsPath();
40
+	}
41 41
 }
Please login to merge, or discard this patch.
core/domain/values/assets/Asset.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     private function setType($type)
84 84
     {
85
-        if (! in_array($type, $this->validAssetTypes(), true)) {
85
+        if ( ! in_array($type, $this->validAssetTypes(), true)) {
86 86
             throw new InvalidDataTypeException(
87 87
                 'Asset::$type',
88 88
                 $type,
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     private function setHandle($handle)
101 101
     {
102
-        if (! is_string($handle)) {
102
+        if ( ! is_string($handle)) {
103 103
             throw new InvalidDataTypeException(
104 104
                 '$handle',
105 105
                 $handle,
Please login to merge, or discard this patch.
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -16,168 +16,168 @@
 block discarded – undo
16 16
 abstract class Asset
17 17
 {
18 18
 
19
-    /**
20
-     * indicates the file extension for a build distribution CSS file
21
-     */
22
-    const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
-
24
-    /**
25
-     * indicates the file extension for a build distribution JS file
26
-     */
27
-    const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
-
29
-    /**
30
-     * Indicates the file extension for a build distribution dependencies json file.
31
-     */
32
-    const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.php';
33
-
34
-    /**
35
-     * indicates a Cascading Style Sheet asset
36
-     */
37
-    const TYPE_CSS = 'css';
38
-
39
-    /**
40
-     * indicates a Javascript asset
41
-     */
42
-    const TYPE_JS = 'js';
43
-
44
-    /**
45
-     * indicates a JSON asset
46
-     */
47
-    CONST TYPE_JSON = 'json';
48
-    /**
49
-     * indicates a PHP asset
50
-     */
51
-    CONST TYPE_PHP = 'php';
52
-
53
-    /**
54
-     * indicates a Javascript manifest file
55
-     */
56
-    const TYPE_MANIFEST = 'manifest';
57
-
58
-    /**
59
-     * @var DomainInterface $domain
60
-     */
61
-    protected $domain;
62
-
63
-    /**
64
-     * @var string $type
65
-     */
66
-    private $type;
67
-
68
-    /**
69
-     * @var string $handle
70
-     */
71
-    private $handle;
72
-
73
-    /**
74
-     * @var bool $registered
75
-     */
76
-    private $registered = false;
77
-
78
-
79
-    /**
80
-     * Asset constructor.
81
-     *
82
-     * @param                 $type
83
-     * @param string          $handle
84
-     * @param DomainInterface $domain
85
-     * @throws InvalidDataTypeException
86
-     */
87
-    public function __construct($type, $handle, DomainInterface $domain)
88
-    {
89
-        $this->domain = $domain;
90
-        $this->setType($type);
91
-        $this->setHandle($handle);
92
-    }
93
-
94
-
95
-    /**
96
-     * @return array
97
-     */
98
-    public function validAssetTypes()
99
-    {
100
-        return array(
101
-            Asset::TYPE_CSS,
102
-            Asset::TYPE_JS,
103
-            Asset::TYPE_MANIFEST,
104
-        );
105
-    }
106
-
107
-
108
-    /**
109
-     * @param string $type
110
-     * @throws InvalidDataTypeException
111
-     */
112
-    private function setType($type)
113
-    {
114
-        if (! in_array($type, $this->validAssetTypes(), true)) {
115
-            throw new InvalidDataTypeException(
116
-                'Asset::$type',
117
-                $type,
118
-                'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
119
-            );
120
-        }
121
-        $this->type = $type;
122
-    }
123
-
124
-
125
-    /**
126
-     * @param string $handle
127
-     * @throws InvalidDataTypeException
128
-     */
129
-    private function setHandle($handle)
130
-    {
131
-        if (! is_string($handle)) {
132
-            throw new InvalidDataTypeException(
133
-                '$handle',
134
-                $handle,
135
-                'string'
136
-            );
137
-        }
138
-        $this->handle = $handle;
139
-    }
140
-
141
-
142
-    /**
143
-     * @return string
144
-     */
145
-    public function assetNamespace()
146
-    {
147
-        return $this->domain->assetNamespace();
148
-    }
149
-
150
-
151
-    /**
152
-     * @return string
153
-     */
154
-    public function type()
155
-    {
156
-        return $this->type;
157
-    }
158
-
159
-
160
-    /**
161
-     * @return string
162
-     */
163
-    public function handle()
164
-    {
165
-        return $this->handle;
166
-    }
167
-
168
-    /**
169
-     * @return bool
170
-     */
171
-    public function isRegistered()
172
-    {
173
-        return $this->registered;
174
-    }
175
-
176
-    /**
177
-     * @param bool $registered
178
-     */
179
-    public function setRegistered($registered = true)
180
-    {
181
-        $this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
182
-    }
19
+	/**
20
+	 * indicates the file extension for a build distribution CSS file
21
+	 */
22
+	const FILE_EXTENSION_DISTRIBUTION_CSS = '.dist.css';
23
+
24
+	/**
25
+	 * indicates the file extension for a build distribution JS file
26
+	 */
27
+	const FILE_EXTENSION_DISTRIBUTION_JS = '.dist.js';
28
+
29
+	/**
30
+	 * Indicates the file extension for a build distribution dependencies json file.
31
+	 */
32
+	const FILE_EXTENSION_DISTRIBUTION_DEPS = '.dist.deps.php';
33
+
34
+	/**
35
+	 * indicates a Cascading Style Sheet asset
36
+	 */
37
+	const TYPE_CSS = 'css';
38
+
39
+	/**
40
+	 * indicates a Javascript asset
41
+	 */
42
+	const TYPE_JS = 'js';
43
+
44
+	/**
45
+	 * indicates a JSON asset
46
+	 */
47
+	CONST TYPE_JSON = 'json';
48
+	/**
49
+	 * indicates a PHP asset
50
+	 */
51
+	CONST TYPE_PHP = 'php';
52
+
53
+	/**
54
+	 * indicates a Javascript manifest file
55
+	 */
56
+	const TYPE_MANIFEST = 'manifest';
57
+
58
+	/**
59
+	 * @var DomainInterface $domain
60
+	 */
61
+	protected $domain;
62
+
63
+	/**
64
+	 * @var string $type
65
+	 */
66
+	private $type;
67
+
68
+	/**
69
+	 * @var string $handle
70
+	 */
71
+	private $handle;
72
+
73
+	/**
74
+	 * @var bool $registered
75
+	 */
76
+	private $registered = false;
77
+
78
+
79
+	/**
80
+	 * Asset constructor.
81
+	 *
82
+	 * @param                 $type
83
+	 * @param string          $handle
84
+	 * @param DomainInterface $domain
85
+	 * @throws InvalidDataTypeException
86
+	 */
87
+	public function __construct($type, $handle, DomainInterface $domain)
88
+	{
89
+		$this->domain = $domain;
90
+		$this->setType($type);
91
+		$this->setHandle($handle);
92
+	}
93
+
94
+
95
+	/**
96
+	 * @return array
97
+	 */
98
+	public function validAssetTypes()
99
+	{
100
+		return array(
101
+			Asset::TYPE_CSS,
102
+			Asset::TYPE_JS,
103
+			Asset::TYPE_MANIFEST,
104
+		);
105
+	}
106
+
107
+
108
+	/**
109
+	 * @param string $type
110
+	 * @throws InvalidDataTypeException
111
+	 */
112
+	private function setType($type)
113
+	{
114
+		if (! in_array($type, $this->validAssetTypes(), true)) {
115
+			throw new InvalidDataTypeException(
116
+				'Asset::$type',
117
+				$type,
118
+				'one of the TYPE_* class constants on \EventEspresso\core\domain\values\Asset is required'
119
+			);
120
+		}
121
+		$this->type = $type;
122
+	}
123
+
124
+
125
+	/**
126
+	 * @param string $handle
127
+	 * @throws InvalidDataTypeException
128
+	 */
129
+	private function setHandle($handle)
130
+	{
131
+		if (! is_string($handle)) {
132
+			throw new InvalidDataTypeException(
133
+				'$handle',
134
+				$handle,
135
+				'string'
136
+			);
137
+		}
138
+		$this->handle = $handle;
139
+	}
140
+
141
+
142
+	/**
143
+	 * @return string
144
+	 */
145
+	public function assetNamespace()
146
+	{
147
+		return $this->domain->assetNamespace();
148
+	}
149
+
150
+
151
+	/**
152
+	 * @return string
153
+	 */
154
+	public function type()
155
+	{
156
+		return $this->type;
157
+	}
158
+
159
+
160
+	/**
161
+	 * @return string
162
+	 */
163
+	public function handle()
164
+	{
165
+		return $this->handle;
166
+	}
167
+
168
+	/**
169
+	 * @return bool
170
+	 */
171
+	public function isRegistered()
172
+	{
173
+		return $this->registered;
174
+	}
175
+
176
+	/**
177
+	 * @param bool $registered
178
+	 */
179
+	public function setRegistered($registered = true)
180
+	{
181
+		$this->registered = filter_var($registered, FILTER_VALIDATE_BOOLEAN);
182
+	}
183 183
 }
Please login to merge, or discard this patch.
core/domain/values/assets/StylesheetAsset.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      */
55 55
     private function setMedia($media)
56 56
     {
57
-        if (! is_string($media)) {
57
+        if ( ! is_string($media)) {
58 58
             throw new InvalidDataTypeException(
59 59
                 '$media',
60 60
                 $media,
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -17,68 +17,68 @@
 block discarded – undo
17 17
 class StylesheetAsset extends BrowserAsset
18 18
 {
19 19
 
20
-    /**
21
-     * @var string $media
22
-     */
23
-    private $media;
20
+	/**
21
+	 * @var string $media
22
+	 */
23
+	private $media;
24 24
 
25 25
 
26
-    /**
27
-     * CssFile constructor.
28
-     *
29
-     * @param                 $handle
30
-     * @param string          $source
31
-     * @param array           $dependencies
32
-     * @param DomainInterface $domain
33
-     * @param string          $media
34
-     * @param string          $version
35
-     * @throws InvalidDataTypeException
36
-     * @throws DomainException
37
-     */
38
-    public function __construct(
39
-        $handle,
40
-        $source,
41
-        array $dependencies,
42
-        DomainInterface $domain,
43
-        $media = 'all',
44
-        $version = ''
45
-    ) {
46
-        parent::__construct(Asset::TYPE_CSS, $handle, $source, $dependencies, $domain, $version);
47
-        $this->setMedia($media);
48
-    }
26
+	/**
27
+	 * CssFile constructor.
28
+	 *
29
+	 * @param                 $handle
30
+	 * @param string          $source
31
+	 * @param array           $dependencies
32
+	 * @param DomainInterface $domain
33
+	 * @param string          $media
34
+	 * @param string          $version
35
+	 * @throws InvalidDataTypeException
36
+	 * @throws DomainException
37
+	 */
38
+	public function __construct(
39
+		$handle,
40
+		$source,
41
+		array $dependencies,
42
+		DomainInterface $domain,
43
+		$media = 'all',
44
+		$version = ''
45
+	) {
46
+		parent::__construct(Asset::TYPE_CSS, $handle, $source, $dependencies, $domain, $version);
47
+		$this->setMedia($media);
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * @return string
53
-     */
54
-    public function media()
55
-    {
56
-        return $this->media;
57
-    }
51
+	/**
52
+	 * @return string
53
+	 */
54
+	public function media()
55
+	{
56
+		return $this->media;
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * @param string $media
62
-     * @throws InvalidDataTypeException
63
-     */
64
-    private function setMedia($media)
65
-    {
66
-        if (! is_string($media)) {
67
-            throw new InvalidDataTypeException(
68
-                '$media',
69
-                $media,
70
-                'string'
71
-            );
72
-        }
73
-        $this->media = $media;
74
-    }
60
+	/**
61
+	 * @param string $media
62
+	 * @throws InvalidDataTypeException
63
+	 */
64
+	private function setMedia($media)
65
+	{
66
+		if (! is_string($media)) {
67
+			throw new InvalidDataTypeException(
68
+				'$media',
69
+				$media,
70
+				'string'
71
+			);
72
+		}
73
+		$this->media = $media;
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @since 4.9.62.p
79
-     */
80
-    public function enqueueAsset()
81
-    {
82
-        wp_enqueue_style($this->handle());
83
-    }
77
+	/**
78
+	 * @since 4.9.62.p
79
+	 */
80
+	public function enqueueAsset()
81
+	{
82
+		wp_enqueue_style($this->handle());
83
+	}
84 84
 }
Please login to merge, or discard this patch.
widgets/EspressoWidget.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,28 +13,28 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
 
16
-    /**
17
-     * @param string $name
18
-     * @param array  $widget_options
19
-     * @param array  $control_options
20
-     */
21
-    public function __construct($name = '', array $widget_options = array(), array $control_options = array())
22
-    {
23
-        $id_base = EspressoWidget::getIdBase(get_class($this));
24
-        $control_options['id_base'] = $id_base;
25
-        $control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300;
26
-        $control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350;
27
-        // Register widget with WordPress
28
-        parent::__construct($id_base, $name, $widget_options, $control_options);
29
-    }
16
+	/**
17
+	 * @param string $name
18
+	 * @param array  $widget_options
19
+	 * @param array  $control_options
20
+	 */
21
+	public function __construct($name = '', array $widget_options = array(), array $control_options = array())
22
+	{
23
+		$id_base = EspressoWidget::getIdBase(get_class($this));
24
+		$control_options['id_base'] = $id_base;
25
+		$control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300;
26
+		$control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350;
27
+		// Register widget with WordPress
28
+		parent::__construct($id_base, $name, $widget_options, $control_options);
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * @param string $widget_class
34
-     * @return string
35
-     */
36
-    public static function getIdBase($widget_class)
37
-    {
38
-        return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget';
39
-    }
32
+	/**
33
+	 * @param string $widget_class
34
+	 * @return string
35
+	 */
36
+	public static function getIdBase($widget_class)
37
+	{
38
+		return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget';
39
+	}
40 40
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,6 @@
 block discarded – undo
35 35
      */
36 36
     public static function getIdBase($widget_class)
37 37
     {
38
-        return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget';
38
+        return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)).'-widget';
39 39
     }
40 40
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorRowStandard.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             '',
175 175
             'tckt-slctr-tbl-td-qty cntr',
176 176
             '',
177
-            'headers="quantity-' . $this->EVT_ID . '"'
177
+            'headers="quantity-'.$this->EVT_ID.'"'
178 178
         );
179 179
         $this->setTicketStatusDisplay($remaining);
180 180
         if (empty($this->ticket_status_display)) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             '',
241 241
             'tckt-slctr-tbl-td-name',
242 242
             '',
243
-            'headers="details-' . $this->EVT_ID . '"'
243
+            'headers="details-'.$this->EVT_ID.'"'
244 244
         );
245 245
         $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
246 246
         $html .= $this->ticket_details->getShowHideLinks();
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                 '',
275 275
                 'tckt-slctr-tbl-td-price jst-rght',
276 276
                 '',
277
-                'headers="price-' . $this->EVT_ID . '"'
277
+                'headers="price-'.$this->EVT_ID.'"'
278 278
             );
279 279
             $html .= \EEH_Template::format_currency($this->ticket_price);
280 280
             $html .= $this->ticket->taxable()
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
         // display submit button since we have tickets available
314 314
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
315 315
         $this->hidden_input_qty = false;
316
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
317
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
318
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
319
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
320
-        $html .= ' id="' . $id . '"';
321
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
316
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
317
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
318
+        $html .= esc_html__('Select this ticket', 'event_espresso').'</label>';
319
+        $html .= '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"';
320
+        $html .= ' id="'.$id.'"';
321
+        $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"';
322 322
         $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
323 323
         $html .= ' title=""/>';
324 324
         return $html;
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
         // display submit button since we have tickets available
337 337
         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
338 338
         $this->hidden_input_qty = false;
339
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
340
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
341
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
342
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
343
-        $html .= ' id="' . $id . '"';
339
+        $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row;
340
+        $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">';
341
+        $html .= esc_html__('Quantity', 'event_espresso').'</label>';
342
+        $html .= '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"';
343
+        $html .= ' id="'.$id.'"';
344 344
         $html .= ' class="ticket-selector-tbl-qty-slct">';
345 345
         // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
346 346
         if ($this->min !== 0 && ! $this->ticket->required()) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         }
349 349
         // offer ticket quantities from the min to the max
350 350
         for ($i = $this->min; $i <= $this->max; $i++) {
351
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
351
+            $html .= '<option value="'.$i.'">&nbsp;'.$i.'&nbsp;</option>';
352 352
         }
353 353
         $html .= '</select>';
354 354
         return $html;
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         $html = '';
367 367
         // depending on group reg we need to change the format for qty
368 368
         if ($this->hidden_input_qty) {
369
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
369
+            $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>';
370 370
         }
371
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
372
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
371
+        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"';
372
+        $html .= ' value="'.$this->ticket->ID().'"/>';
373 373
         return $html;
374 374
     }
375 375
 }
Please login to merge, or discard this patch.
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -17,356 +17,356 @@
 block discarded – undo
17 17
 class TicketSelectorRowStandard extends TicketSelectorRow
18 18
 {
19 19
 
20
-    /**
21
-     * @var TicketDetails $ticket_details
22
-     */
23
-    protected $ticket_details;
24
-
25
-    /**
26
-     * @var \EE_Ticket_Selector_Config $template_settings
27
-     */
28
-    protected $template_settings;
29
-
30
-    /**
31
-     * @var EE_Tax_Config $tax_settings
32
-     */
33
-    protected $tax_settings;
34
-
35
-    /**
36
-     * @var boolean $prices_displayed_including_taxes
37
-     */
38
-    protected $prices_displayed_including_taxes;
39
-
40
-    /**
41
-     * @var int $row
42
-     */
43
-    protected $row;
44
-
45
-    /**
46
-     * @var int $cols
47
-     */
48
-    protected $cols;
49
-
50
-    /**
51
-     * @var boolean $hidden_input_qty
52
-     */
53
-    protected $hidden_input_qty;
54
-
55
-    /**
56
-     * @var string $ticket_datetime_classes
57
-     */
58
-    protected $ticket_datetime_classes;
59
-
60
-
61
-    /**
62
-     * TicketDetails constructor.
63
-     *
64
-     * @param TicketDetails $ticket_details
65
-     * @param EE_Tax_Config $tax_settings
66
-     * @param int           $total_tickets
67
-     * @param int           $max_attendees
68
-     * @param int           $row
69
-     * @param int           $cols
70
-     * @param boolean       $required_ticket_sold_out
71
-     * @param string        $event_status
72
-     * @param string        $ticket_datetime_classes
73
-     * @throws EE_Error
74
-     * @throws UnexpectedEntityException
75
-     */
76
-    public function __construct(
77
-        TicketDetails $ticket_details,
78
-        EE_Tax_Config $tax_settings,
79
-        $total_tickets,
80
-        $max_attendees,
81
-        $row,
82
-        $cols,
83
-        $required_ticket_sold_out,
84
-        $event_status,
85
-        $ticket_datetime_classes
86
-    ) {
87
-        $this->ticket_details = $ticket_details;
88
-        $this->template_settings = $ticket_details->getTemplateSettings();
89
-        $this->tax_settings = $tax_settings;
90
-        $this->row = $row;
91
-        $this->cols = $cols;
92
-        $this->ticket_datetime_classes = $ticket_datetime_classes;
93
-        parent::__construct(
94
-            $ticket_details->getTicket(),
95
-            $max_attendees,
96
-            $ticket_details->getDateFormat(),
97
-            $event_status,
98
-            $required_ticket_sold_out,
99
-            $total_tickets
100
-        );
101
-    }
102
-
103
-
104
-    /**
105
-     * other ticket rows will need to know if a required ticket is sold out,
106
-     * so that they are not offered for sale
107
-     *
108
-     * @return boolean
109
-     */
110
-    public function getRequiredTicketSoldOut()
111
-    {
112
-        return $this->required_ticket_sold_out;
113
-    }
114
-
115
-
116
-    /**
117
-     * @return int
118
-     */
119
-    public function getCols()
120
-    {
121
-        return $this->cols;
122
-    }
123
-
124
-
125
-    /**
126
-     * getHtml
127
-     *
128
-     * @return string
129
-     * @throws EE_Error
130
-     */
131
-    public function getHtml()
132
-    {
133
-        $this->min = 0;
134
-        $this->max = $this->ticket->max();
135
-        $remaining = $this->ticket->remaining();
136
-        $this->setTicketMinAndMax($remaining);
137
-        // set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
138
-        $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
139
-            ? $this->ticket->start_date()
140
-            : $this->required_ticket_sold_out;
141
-        $this->setTicketPriceDetails();
142
-        $this->setTicketStatusClasses($remaining);
143
-        $filtered_row_html = $this->getFilteredRowHtml();
144
-        if ($filtered_row_html !== false) {
145
-            return $filtered_row_html;
146
-        }
147
-        $ticket_selector_row_html = EEH_HTML::tr(
148
-            '',
149
-            '',
150
-            "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
151
-            . espresso_get_object_css_class($this->ticket)
152
-        );
153
-        $filtered_row_content = $this->getFilteredRowContents();
154
-        if ($filtered_row_content !== false && $this->max_attendees === 1) {
155
-            return $ticket_selector_row_html
156
-                   . $filtered_row_content
157
-                   . $this->ticketQtyAndIdHiddenInputs()
158
-                   . EEH_HTML::trx();
159
-        }
160
-        if ($filtered_row_content !== false) {
161
-            return $ticket_selector_row_html
162
-                   . $filtered_row_content
163
-                   . EEH_HTML::trx();
164
-        }
165
-        $this->hidden_input_qty = $this->max_attendees > 1;
166
-
167
-        $ticket_selector_row_html .= $this->ticketNameTableCell();
168
-        $ticket_selector_row_html .= $this->ticketPriceTableCell();
169
-        $ticket_selector_row_html .= EEH_HTML::td(
170
-            '',
171
-            '',
172
-            'tckt-slctr-tbl-td-qty cntr',
173
-            '',
174
-            'headers="quantity-' . $this->EVT_ID . '"'
175
-        );
176
-        $this->setTicketStatusDisplay($remaining);
177
-        if (empty($this->ticket_status_display)) {
178
-            if ($this->max_attendees === 1) {
179
-                // only ONE attendee is allowed to register at a time
180
-                $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
181
-            } elseif ($this->max > 0) {
182
-                $ticket_selector_row_html .= $this->ticketQuantitySelector();
183
-            }
184
-        }
185
-        $ticket_selector_row_html .= $this->ticket_status_display;
186
-        $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
187
-        $ticket_selector_row_html .= $this->ticket_details->display(
188
-            $this->ticket_price,
189
-            $remaining,
190
-            $this->cols
191
-        );
192
-        $ticket_selector_row_html .= EEH_HTML::tdx();
193
-        $ticket_selector_row_html .= EEH_HTML::trx();
194
-
195
-
196
-        $this->row++;
197
-        return $ticket_selector_row_html;
198
-    }
199
-
200
-
201
-    /**
202
-     * getTicketPriceDetails
203
-     *
204
-     * @return void
205
-     * @throws EE_Error
206
-     */
207
-    protected function setTicketPriceDetails()
208
-    {
209
-        $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
210
-            ? $this->ticket->get_ticket_total_with_taxes()
211
-            : $this->ticket->get_ticket_subtotal();
212
-        $this->ticket_bundle = false;
213
-        $ticket_min = $this->ticket->min();
214
-        // for ticket bundles, set min and max qty the same
215
-        if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
216
-            $this->ticket_price *= $ticket_min;
217
-            $this->ticket_bundle = true;
218
-        }
219
-        $this->ticket_price = apply_filters(
220
-            'FHEE__ticket_selector_chart_template__ticket_price',
221
-            $this->ticket_price,
222
-            $this->ticket
223
-        );
224
-    }
225
-
226
-
227
-    /**
228
-     * ticketNameTableCell
229
-     *
230
-     * @return string
231
-     * @throws EE_Error
232
-     */
233
-    protected function ticketNameTableCell()
234
-    {
235
-        $html = EEH_HTML::td(
236
-            '',
237
-            '',
238
-            'tckt-slctr-tbl-td-name',
239
-            '',
240
-            'headers="details-' . $this->EVT_ID . '"'
241
-        );
242
-        $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
243
-        $html .= $this->ticket_details->getShowHideLinks();
244
-        if ($this->ticket->required()) {
245
-            $html .= EEH_HTML::p(
246
-                apply_filters(
247
-                    'FHEE__ticket_selector_chart_template__ticket_required_message',
248
-                    esc_html__('This ticket is required and must be purchased.', 'event_espresso')
249
-                ),
250
-                '',
251
-                'ticket-required-pg'
252
-            );
253
-        }
254
-        $html .= EEH_HTML::tdx();
255
-        return $html;
256
-    }
257
-
258
-
259
-    /**
260
-     * ticketPriceTableCell
261
-     *
262
-     * @return string
263
-     * @throws EE_Error
264
-     */
265
-    protected function ticketPriceTableCell()
266
-    {
267
-        $html = '';
268
-        if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
269
-            $html .= EEH_HTML::td(
270
-                '',
271
-                '',
272
-                'tckt-slctr-tbl-td-price jst-rght',
273
-                '',
274
-                'headers="price-' . $this->EVT_ID . '"'
275
-            );
276
-            $html .= \EEH_Template::format_currency($this->ticket_price);
277
-            $html .= $this->ticket->taxable()
278
-                ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
279
-                : '';
280
-            $html .= '&nbsp;';
281
-            // phpcs:disable WordPress.WP.I18n.NoEmptyStrings
282
-            $html .= EEH_HTML::span(
283
-                $this->ticket_bundle
284
-                    ? apply_filters(
285
-                        'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
286
-                        __(' / bundle', 'event_espresso')
287
-                    )
288
-                    : apply_filters(
289
-                        'FHEE__ticket_selector_chart_template__per_ticket_text',
290
-                        __('', 'event_espresso')
291
-                    ),
292
-                '',
293
-                'smaller-text no-bold'
294
-            );
295
-            $html .= '&nbsp;';
296
-            $html .= EEH_HTML::tdx();
297
-            $this->cols++;
298
-        }
299
-        return $html;
300
-    }
301
-
302
-
303
-    /**
304
-     * onlyOneAttendeeCanRegister
305
-     *
306
-     * @return string
307
-     */
308
-    protected function onlyOneAttendeeCanRegister()
309
-    {
310
-        // display submit button since we have tickets available
311
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
312
-        $this->hidden_input_qty = false;
313
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
314
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
315
-        $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
316
-        $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
317
-        $html .= ' id="' . $id . '"';
318
-        $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
319
-        $html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
320
-        $html .= ' title=""/>';
321
-        return $html;
322
-    }
323
-
324
-
325
-    /**
326
-     * ticketQuantitySelector
327
-     *
328
-     * @return string
329
-     * @throws EE_Error
330
-     */
331
-    protected function ticketQuantitySelector()
332
-    {
333
-        // display submit button since we have tickets available
334
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
335
-        $this->hidden_input_qty = false;
336
-        $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
337
-        $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
338
-        $html .= esc_html__('Quantity', 'event_espresso') . '</label>';
339
-        $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
340
-        $html .= ' id="' . $id . '"';
341
-        $html .= ' class="ticket-selector-tbl-qty-slct">';
342
-        // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
343
-        if ($this->min !== 0 && ! $this->ticket->required()) {
344
-            $html .= '<option value="0">&nbsp;0&nbsp;</option>';
345
-        }
346
-        // offer ticket quantities from the min to the max
347
-        for ($i = $this->min; $i <= $this->max; $i++) {
348
-            $html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
349
-        }
350
-        $html .= '</select>';
351
-        return $html;
352
-    }
353
-
354
-
355
-    /**
356
-     * getHiddenInputs
357
-     *
358
-     * @return string
359
-     * @throws EE_Error
360
-     */
361
-    protected function ticketQtyAndIdHiddenInputs()
362
-    {
363
-        $html = '';
364
-        // depending on group reg we need to change the format for qty
365
-        if ($this->hidden_input_qty) {
366
-            $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
367
-        }
368
-        $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
369
-        $html .= ' value="' . $this->ticket->ID() . '"/>';
370
-        return $html;
371
-    }
20
+	/**
21
+	 * @var TicketDetails $ticket_details
22
+	 */
23
+	protected $ticket_details;
24
+
25
+	/**
26
+	 * @var \EE_Ticket_Selector_Config $template_settings
27
+	 */
28
+	protected $template_settings;
29
+
30
+	/**
31
+	 * @var EE_Tax_Config $tax_settings
32
+	 */
33
+	protected $tax_settings;
34
+
35
+	/**
36
+	 * @var boolean $prices_displayed_including_taxes
37
+	 */
38
+	protected $prices_displayed_including_taxes;
39
+
40
+	/**
41
+	 * @var int $row
42
+	 */
43
+	protected $row;
44
+
45
+	/**
46
+	 * @var int $cols
47
+	 */
48
+	protected $cols;
49
+
50
+	/**
51
+	 * @var boolean $hidden_input_qty
52
+	 */
53
+	protected $hidden_input_qty;
54
+
55
+	/**
56
+	 * @var string $ticket_datetime_classes
57
+	 */
58
+	protected $ticket_datetime_classes;
59
+
60
+
61
+	/**
62
+	 * TicketDetails constructor.
63
+	 *
64
+	 * @param TicketDetails $ticket_details
65
+	 * @param EE_Tax_Config $tax_settings
66
+	 * @param int           $total_tickets
67
+	 * @param int           $max_attendees
68
+	 * @param int           $row
69
+	 * @param int           $cols
70
+	 * @param boolean       $required_ticket_sold_out
71
+	 * @param string        $event_status
72
+	 * @param string        $ticket_datetime_classes
73
+	 * @throws EE_Error
74
+	 * @throws UnexpectedEntityException
75
+	 */
76
+	public function __construct(
77
+		TicketDetails $ticket_details,
78
+		EE_Tax_Config $tax_settings,
79
+		$total_tickets,
80
+		$max_attendees,
81
+		$row,
82
+		$cols,
83
+		$required_ticket_sold_out,
84
+		$event_status,
85
+		$ticket_datetime_classes
86
+	) {
87
+		$this->ticket_details = $ticket_details;
88
+		$this->template_settings = $ticket_details->getTemplateSettings();
89
+		$this->tax_settings = $tax_settings;
90
+		$this->row = $row;
91
+		$this->cols = $cols;
92
+		$this->ticket_datetime_classes = $ticket_datetime_classes;
93
+		parent::__construct(
94
+			$ticket_details->getTicket(),
95
+			$max_attendees,
96
+			$ticket_details->getDateFormat(),
97
+			$event_status,
98
+			$required_ticket_sold_out,
99
+			$total_tickets
100
+		);
101
+	}
102
+
103
+
104
+	/**
105
+	 * other ticket rows will need to know if a required ticket is sold out,
106
+	 * so that they are not offered for sale
107
+	 *
108
+	 * @return boolean
109
+	 */
110
+	public function getRequiredTicketSoldOut()
111
+	{
112
+		return $this->required_ticket_sold_out;
113
+	}
114
+
115
+
116
+	/**
117
+	 * @return int
118
+	 */
119
+	public function getCols()
120
+	{
121
+		return $this->cols;
122
+	}
123
+
124
+
125
+	/**
126
+	 * getHtml
127
+	 *
128
+	 * @return string
129
+	 * @throws EE_Error
130
+	 */
131
+	public function getHtml()
132
+	{
133
+		$this->min = 0;
134
+		$this->max = $this->ticket->max();
135
+		$remaining = $this->ticket->remaining();
136
+		$this->setTicketMinAndMax($remaining);
137
+		// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
138
+		$this->required_ticket_sold_out = $this->ticket->required() && ! $remaining
139
+			? $this->ticket->start_date()
140
+			: $this->required_ticket_sold_out;
141
+		$this->setTicketPriceDetails();
142
+		$this->setTicketStatusClasses($remaining);
143
+		$filtered_row_html = $this->getFilteredRowHtml();
144
+		if ($filtered_row_html !== false) {
145
+			return $filtered_row_html;
146
+		}
147
+		$ticket_selector_row_html = EEH_HTML::tr(
148
+			'',
149
+			'',
150
+			"tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} "
151
+			. espresso_get_object_css_class($this->ticket)
152
+		);
153
+		$filtered_row_content = $this->getFilteredRowContents();
154
+		if ($filtered_row_content !== false && $this->max_attendees === 1) {
155
+			return $ticket_selector_row_html
156
+				   . $filtered_row_content
157
+				   . $this->ticketQtyAndIdHiddenInputs()
158
+				   . EEH_HTML::trx();
159
+		}
160
+		if ($filtered_row_content !== false) {
161
+			return $ticket_selector_row_html
162
+				   . $filtered_row_content
163
+				   . EEH_HTML::trx();
164
+		}
165
+		$this->hidden_input_qty = $this->max_attendees > 1;
166
+
167
+		$ticket_selector_row_html .= $this->ticketNameTableCell();
168
+		$ticket_selector_row_html .= $this->ticketPriceTableCell();
169
+		$ticket_selector_row_html .= EEH_HTML::td(
170
+			'',
171
+			'',
172
+			'tckt-slctr-tbl-td-qty cntr',
173
+			'',
174
+			'headers="quantity-' . $this->EVT_ID . '"'
175
+		);
176
+		$this->setTicketStatusDisplay($remaining);
177
+		if (empty($this->ticket_status_display)) {
178
+			if ($this->max_attendees === 1) {
179
+				// only ONE attendee is allowed to register at a time
180
+				$ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister();
181
+			} elseif ($this->max > 0) {
182
+				$ticket_selector_row_html .= $this->ticketQuantitySelector();
183
+			}
184
+		}
185
+		$ticket_selector_row_html .= $this->ticket_status_display;
186
+		$ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs();
187
+		$ticket_selector_row_html .= $this->ticket_details->display(
188
+			$this->ticket_price,
189
+			$remaining,
190
+			$this->cols
191
+		);
192
+		$ticket_selector_row_html .= EEH_HTML::tdx();
193
+		$ticket_selector_row_html .= EEH_HTML::trx();
194
+
195
+
196
+		$this->row++;
197
+		return $ticket_selector_row_html;
198
+	}
199
+
200
+
201
+	/**
202
+	 * getTicketPriceDetails
203
+	 *
204
+	 * @return void
205
+	 * @throws EE_Error
206
+	 */
207
+	protected function setTicketPriceDetails()
208
+	{
209
+		$this->ticket_price = $this->tax_settings->prices_displayed_including_taxes
210
+			? $this->ticket->get_ticket_total_with_taxes()
211
+			: $this->ticket->get_ticket_subtotal();
212
+		$this->ticket_bundle = false;
213
+		$ticket_min = $this->ticket->min();
214
+		// for ticket bundles, set min and max qty the same
215
+		if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) {
216
+			$this->ticket_price *= $ticket_min;
217
+			$this->ticket_bundle = true;
218
+		}
219
+		$this->ticket_price = apply_filters(
220
+			'FHEE__ticket_selector_chart_template__ticket_price',
221
+			$this->ticket_price,
222
+			$this->ticket
223
+		);
224
+	}
225
+
226
+
227
+	/**
228
+	 * ticketNameTableCell
229
+	 *
230
+	 * @return string
231
+	 * @throws EE_Error
232
+	 */
233
+	protected function ticketNameTableCell()
234
+	{
235
+		$html = EEH_HTML::td(
236
+			'',
237
+			'',
238
+			'tckt-slctr-tbl-td-name',
239
+			'',
240
+			'headers="details-' . $this->EVT_ID . '"'
241
+		);
242
+		$html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name'));
243
+		$html .= $this->ticket_details->getShowHideLinks();
244
+		if ($this->ticket->required()) {
245
+			$html .= EEH_HTML::p(
246
+				apply_filters(
247
+					'FHEE__ticket_selector_chart_template__ticket_required_message',
248
+					esc_html__('This ticket is required and must be purchased.', 'event_espresso')
249
+				),
250
+				'',
251
+				'ticket-required-pg'
252
+			);
253
+		}
254
+		$html .= EEH_HTML::tdx();
255
+		return $html;
256
+	}
257
+
258
+
259
+	/**
260
+	 * ticketPriceTableCell
261
+	 *
262
+	 * @return string
263
+	 * @throws EE_Error
264
+	 */
265
+	protected function ticketPriceTableCell()
266
+	{
267
+		$html = '';
268
+		if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
269
+			$html .= EEH_HTML::td(
270
+				'',
271
+				'',
272
+				'tckt-slctr-tbl-td-price jst-rght',
273
+				'',
274
+				'headers="price-' . $this->EVT_ID . '"'
275
+			);
276
+			$html .= \EEH_Template::format_currency($this->ticket_price);
277
+			$html .= $this->ticket->taxable()
278
+				? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text')
279
+				: '';
280
+			$html .= '&nbsp;';
281
+			// phpcs:disable WordPress.WP.I18n.NoEmptyStrings
282
+			$html .= EEH_HTML::span(
283
+				$this->ticket_bundle
284
+					? apply_filters(
285
+						'FHEE__ticket_selector_chart_template__per_ticket_bundle_text',
286
+						__(' / bundle', 'event_espresso')
287
+					)
288
+					: apply_filters(
289
+						'FHEE__ticket_selector_chart_template__per_ticket_text',
290
+						__('', 'event_espresso')
291
+					),
292
+				'',
293
+				'smaller-text no-bold'
294
+			);
295
+			$html .= '&nbsp;';
296
+			$html .= EEH_HTML::tdx();
297
+			$this->cols++;
298
+		}
299
+		return $html;
300
+	}
301
+
302
+
303
+	/**
304
+	 * onlyOneAttendeeCanRegister
305
+	 *
306
+	 * @return string
307
+	 */
308
+	protected function onlyOneAttendeeCanRegister()
309
+	{
310
+		// display submit button since we have tickets available
311
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
312
+		$this->hidden_input_qty = false;
313
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
314
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
315
+		$html .= esc_html__('Select this ticket', 'event_espresso') . '</label>';
316
+		$html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"';
317
+		$html .= ' id="' . $id . '"';
318
+		$html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"';
319
+		$html .= $this->total_tickets === 1 ? ' checked="checked"' : '';
320
+		$html .= ' title=""/>';
321
+		return $html;
322
+	}
323
+
324
+
325
+	/**
326
+	 * ticketQuantitySelector
327
+	 *
328
+	 * @return string
329
+	 * @throws EE_Error
330
+	 */
331
+	protected function ticketQuantitySelector()
332
+	{
333
+		// display submit button since we have tickets available
334
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
335
+		$this->hidden_input_qty = false;
336
+		$id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row;
337
+		$html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">';
338
+		$html .= esc_html__('Quantity', 'event_espresso') . '</label>';
339
+		$html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"';
340
+		$html .= ' id="' . $id . '"';
341
+		$html .= ' class="ticket-selector-tbl-qty-slct">';
342
+		// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
343
+		if ($this->min !== 0 && ! $this->ticket->required()) {
344
+			$html .= '<option value="0">&nbsp;0&nbsp;</option>';
345
+		}
346
+		// offer ticket quantities from the min to the max
347
+		for ($i = $this->min; $i <= $this->max; $i++) {
348
+			$html .= '<option value="' . $i . '">&nbsp;' . $i . '&nbsp;</option>';
349
+		}
350
+		$html .= '</select>';
351
+		return $html;
352
+	}
353
+
354
+
355
+	/**
356
+	 * getHiddenInputs
357
+	 *
358
+	 * @return string
359
+	 * @throws EE_Error
360
+	 */
361
+	protected function ticketQtyAndIdHiddenInputs()
362
+	{
363
+		$html = '';
364
+		// depending on group reg we need to change the format for qty
365
+		if ($this->hidden_input_qty) {
366
+			$html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>';
367
+		}
368
+		$html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"';
369
+		$html .= ' value="' . $this->ticket->ID() . '"/>';
370
+		return $html;
371
+	}
372 372
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketSelectorIframeEmbedButton.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,24 +14,24 @@
 block discarded – undo
14 14
 class TicketSelectorIframeEmbedButton extends IframeEmbedButton
15 15
 {
16 16
 
17
-    /**
18
-     * TicketSelectorIframeEmbedButton constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        parent::__construct(
23
-            esc_html__('Ticket Selector', 'event_espresso'),
24
-            'ticket_selector'
25
-        );
26
-    }
17
+	/**
18
+	 * TicketSelectorIframeEmbedButton constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		parent::__construct(
23
+			esc_html__('Ticket Selector', 'event_espresso'),
24
+			'ticket_selector'
25
+		);
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * Adds an iframe embed code button to the Event editor.
31
-     */
32
-    public function addEventEditorIframeEmbedButton()
33
-    {
34
-        // add button for iframe code to event editor.
35
-        $this->addEventEditorIframeEmbedButtonFilter();
36
-    }
29
+	/**
30
+	 * Adds an iframe embed code button to the Event editor.
31
+	 */
32
+	public function addEventEditorIframeEmbedButton()
33
+	{
34
+		// add button for iframe code to event editor.
35
+		$this->addEventEditorIframeEmbedButtonFilter();
36
+	}
37 37
 }
Please login to merge, or discard this patch.