Completed
Branch ADMIN-REFRESH (acf4af)
by
unknown
05:37 queued 02:47
created
core/interfaces/EEI_Request_Decorator.interface.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,24 +9,24 @@
 block discarded – undo
9 9
 interface EEI_Request_Decorator
10 10
 {
11 11
 
12
-    /**
13
-     * converts a Request to a Response
14
-     * can perform their logic either before or after the core application has run like so:
15
-     *    public function handle_request( EE_Request $request, EE_Response $response ) {
16
-     *        $this->request = $request;
17
-     *        $this->response = $response;
18
-     *      // logic performed BEFORE core app has run
19
-     *      $this->process_request_stack( $this->request, $this->response );
20
-     *      // logic performed AFTER core app has run
21
-     *      return $response;
22
-     *    }
23
-     *
24
-     * @deprecated 4.9.53
25
-     * @param    EE_Request $request
26
-     * @param    EE_Response   $response
27
-     * @return    EE_Response
28
-     */
29
-    public function handle_request(EE_Request $request, EE_Response $response);
12
+	/**
13
+	 * converts a Request to a Response
14
+	 * can perform their logic either before or after the core application has run like so:
15
+	 *    public function handle_request( EE_Request $request, EE_Response $response ) {
16
+	 *        $this->request = $request;
17
+	 *        $this->response = $response;
18
+	 *      // logic performed BEFORE core app has run
19
+	 *      $this->process_request_stack( $this->request, $this->response );
20
+	 *      // logic performed AFTER core app has run
21
+	 *      return $response;
22
+	 *    }
23
+	 *
24
+	 * @deprecated 4.9.53
25
+	 * @param    EE_Request $request
26
+	 * @param    EE_Response   $response
27
+	 * @return    EE_Response
28
+	 */
29
+	public function handle_request(EE_Request $request, EE_Response $response);
30 30
 
31 31
 
32 32
 }
Please login to merge, or discard this patch.
core/services/request/middleware/PreProductionVersionWarning.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
     public function preProductionVersionAdminNotice()
79 79
     {
80 80
         new PersistentAdminNotice(
81
-            'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION,
81
+            'preProductionVersionAdminNotice_'.EVENT_ESPRESSO_VERSION,
82 82
             $this->warningNotice()
83 83
         );
84 84
     }
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -18,91 +18,91 @@
 block discarded – undo
18 18
 class PreProductionVersionWarning extends Middleware
19 19
 {
20 20
 
21
-    /**
22
-     * converts a Request to a Response
23
-     *
24
-     * @param RequestInterface  $request
25
-     * @param ResponseInterface $response
26
-     * @return ResponseInterface
27
-     */
28
-    public function handleRequest(RequestInterface $request, ResponseInterface $response)
29
-    {
30
-        $this->request = $request;
31
-        $this->response = $response;
32
-        $this->displayPreProductionVersionWarning();
33
-        $this->response = $this->processRequestStack($this->request, $this->response);
34
-        return $this->response;
35
-    }
21
+	/**
22
+	 * converts a Request to a Response
23
+	 *
24
+	 * @param RequestInterface  $request
25
+	 * @param ResponseInterface $response
26
+	 * @return ResponseInterface
27
+	 */
28
+	public function handleRequest(RequestInterface $request, ResponseInterface $response)
29
+	{
30
+		$this->request = $request;
31
+		$this->response = $response;
32
+		$this->displayPreProductionVersionWarning();
33
+		$this->response = $this->processRequestStack($this->request, $this->response);
34
+		return $this->response;
35
+	}
36 36
 
37 37
 
38
-    /**
39
-     * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode
40
-     *
41
-     * @return void
42
-     */
43
-    public function displayPreProductionVersionWarning()
44
-    {
45
-        // skip AJAX requests
46
-        if ($this->request->isAjax()) {
47
-            return;
48
-        }
49
-        // skip stable releases
50
-        if (substr(EVENT_ESPRESSO_VERSION, -5) !== '.beta') {
51
-            return;
52
-        }
53
-        // site admin has authorized use of non-stable release candidate for production
54
-        if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
55
-            return;
56
-        }
57
-        // post release candidate warning
58
-        if ($this->request->isAdmin()) {
59
-            add_action('admin_notices', array($this, 'preProductionVersionAdminNotice'), -999);
60
-        } else {
61
-            add_action('shutdown', array($this, 'preProductionVersionWarningNotice'), 10);
62
-        }
63
-    }
38
+	/**
39
+	 * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode
40
+	 *
41
+	 * @return void
42
+	 */
43
+	public function displayPreProductionVersionWarning()
44
+	{
45
+		// skip AJAX requests
46
+		if ($this->request->isAjax()) {
47
+			return;
48
+		}
49
+		// skip stable releases
50
+		if (substr(EVENT_ESPRESSO_VERSION, -5) !== '.beta') {
51
+			return;
52
+		}
53
+		// site admin has authorized use of non-stable release candidate for production
54
+		if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
55
+			return;
56
+		}
57
+		// post release candidate warning
58
+		if ($this->request->isAdmin()) {
59
+			add_action('admin_notices', array($this, 'preProductionVersionAdminNotice'), -999);
60
+		} else {
61
+			add_action('shutdown', array($this, 'preProductionVersionWarningNotice'), 10);
62
+		}
63
+	}
64 64
 
65 65
 
66
-    /**
67
-     * displays admin notice that current version of EE is not a stable release
68
-     *
69
-     * @return void
70
-     * @throws InvalidDataTypeException
71
-     */
72
-    public function preProductionVersionAdminNotice()
73
-    {
74
-        new PersistentAdminNotice(
75
-            'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION,
76
-            $this->warningNotice()
77
-        );
78
-    }
66
+	/**
67
+	 * displays admin notice that current version of EE is not a stable release
68
+	 *
69
+	 * @return void
70
+	 * @throws InvalidDataTypeException
71
+	 */
72
+	public function preProductionVersionAdminNotice()
73
+	{
74
+		new PersistentAdminNotice(
75
+			'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION,
76
+			$this->warningNotice()
77
+		);
78
+	}
79 79
 
80 80
 
81
-    /**
82
-     * displays message on frontend of site notifying admin that current version of EE is not a stable release
83
-     *
84
-     * @return void
85
-     */
86
-    public function preProductionVersionWarningNotice()
87
-    {
88
-        echo '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>';
89
-        echo $this->warningNotice(); // already escaped
90
-        echo '</p></div>';
91
-    }
81
+	/**
82
+	 * displays message on frontend of site notifying admin that current version of EE is not a stable release
83
+	 *
84
+	 * @return void
85
+	 */
86
+	public function preProductionVersionWarningNotice()
87
+	{
88
+		echo '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>';
89
+		echo $this->warningNotice(); // already escaped
90
+		echo '</p></div>';
91
+	}
92 92
 
93 93
 
94
-    /**
95
-     * @return string
96
-     */
97
-    private function warningNotice()
98
-    {
99
-        return sprintf(
100
-            esc_html__(
101
-                'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.',
102
-                'event_espresso'
103
-            ),
104
-            '<strong>',
105
-            '</strong>'
106
-        );
107
-    }
94
+	/**
95
+	 * @return string
96
+	 */
97
+	private function warningNotice()
98
+	{
99
+		return sprintf(
100
+			esc_html__(
101
+				'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.',
102
+				'event_espresso'
103
+			),
104
+			'<strong>',
105
+			'</strong>'
106
+		);
107
+	}
108 108
 }
Please login to merge, or discard this patch.
core/services/request/RequestStack.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,59 +19,59 @@
 block discarded – undo
19 19
 class RequestStack
20 20
 {
21 21
 
22
-    /**
23
-     * @var RequestDecoratorInterface $request_stack_app
24
-     */
25
-    protected $request_stack_app;
22
+	/**
23
+	 * @var RequestDecoratorInterface $request_stack_app
24
+	 */
25
+	protected $request_stack_app;
26 26
 
27
-    /**
28
-     * @var RequestStackCoreAppInterface $core_app
29
-     */
30
-    protected $core_app;
27
+	/**
28
+	 * @var RequestStackCoreAppInterface $core_app
29
+	 */
30
+	protected $core_app;
31 31
 
32
-    /**
33
-     * @var RequestInterface $request
34
-     */
35
-    protected $request;
32
+	/**
33
+	 * @var RequestInterface $request
34
+	 */
35
+	protected $request;
36 36
 
37
-    /**
38
-     * @var ResponseInterface $response
39
-     */
40
-    protected $response;
37
+	/**
38
+	 * @var ResponseInterface $response
39
+	 */
40
+	protected $response;
41 41
 
42 42
 
43
-    /**
44
-     * @param RequestDecoratorInterface    $request_stack_app
45
-     * @param RequestStackCoreAppInterface $core_app
46
-     */
47
-    public function __construct(RequestDecoratorInterface $request_stack_app, RequestStackCoreAppInterface $core_app)
48
-    {
49
-        $this->request_stack_app = $request_stack_app;
50
-        $this->core_app      = $core_app;
51
-    }
43
+	/**
44
+	 * @param RequestDecoratorInterface    $request_stack_app
45
+	 * @param RequestStackCoreAppInterface $core_app
46
+	 */
47
+	public function __construct(RequestDecoratorInterface $request_stack_app, RequestStackCoreAppInterface $core_app)
48
+	{
49
+		$this->request_stack_app = $request_stack_app;
50
+		$this->core_app      = $core_app;
51
+	}
52 52
 
53 53
 
54
-    /**
55
-     * @param RequestInterface  $request
56
-     * @param ResponseInterface $response
57
-     * @return ResponseInterface
58
-     */
59
-    public function handleRequest(RequestInterface $request, ResponseInterface $response)
60
-    {
61
-        $this->request  = $request;
62
-        $this->response = $response;
63
-        return $this->request_stack_app->handleRequest($request, $response);
64
-    }
54
+	/**
55
+	 * @param RequestInterface  $request
56
+	 * @param ResponseInterface $response
57
+	 * @return ResponseInterface
58
+	 */
59
+	public function handleRequest(RequestInterface $request, ResponseInterface $response)
60
+	{
61
+		$this->request  = $request;
62
+		$this->response = $response;
63
+		return $this->request_stack_app->handleRequest($request, $response);
64
+	}
65 65
 
66 66
 
67
-    /**
68
-     * handle_response
69
-     * executes the handle_response() method on the RequestStackCoreAppInterface object
70
-     * after the request stack has been fully processed
71
-     */
72
-    public function handleResponse()
73
-    {
74
-        $this->core_app->handleResponse($this->request, $this->response);
75
-    }
67
+	/**
68
+	 * handle_response
69
+	 * executes the handle_response() method on the RequestStackCoreAppInterface object
70
+	 * after the request stack has been fully processed
71
+	 */
72
+	public function handleResponse()
73
+	{
74
+		$this->core_app->handleResponse($this->request, $this->response);
75
+	}
76 76
 }
77 77
 // Location: RequestStack.php
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public function __construct(RequestDecoratorInterface $request_stack_app, RequestStackCoreAppInterface $core_app)
48 48
     {
49 49
         $this->request_stack_app = $request_stack_app;
50
-        $this->core_app      = $core_app;
50
+        $this->core_app = $core_app;
51 51
     }
52 52
 
53 53
 
Please login to merge, or discard this patch.
core/services/collections/iterators/CollectionFilterCallbackIterator.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -9,51 +9,51 @@
 block discarded – undo
9 9
 class CollectionFilterCallbackIterator extends FilterIterator
10 10
 {
11 11
 
12
-    /**
13
-     * Used for determining whether the iterated object in the Collection is "valid" or not.
14
-     * @var Closure
15
-     */
16
-    private $acceptance_callback;
17
-
18
-
19
-    /**
20
-     * CollectionFilterCallbackIterator constructor.
21
-     *
22
-     * @param Collection $collection
23
-     * @param Closure    $acceptance_callback  The closure will receive an instance of whatever object is stored on the
24
-     *                                         collection when iterating over the collection and should return boolean.
25
-     */
26
-    public function __construct(Collection $collection, Closure $acceptance_callback)
27
-    {
28
-        $this->acceptance_callback = $acceptance_callback;
29
-        parent::__construct($collection);
30
-    }
31
-
32
-    /**
33
-     * Check whether the current element of the iterator is acceptable
34
-     *
35
-     * @link  http://php.net/manual/en/filteriterator.accept.php
36
-     * @return bool true if the current element is acceptable, otherwise false.
37
-     */
38
-    public function accept()
39
-    {
40
-        $acceptance_callback = $this->acceptance_callback;
41
-        return $acceptance_callback($this->getInnerIterator()->current());
42
-    }
43
-
44
-
45
-
46
-    /**
47
-     * Returns a filtered array of objects from the collection using the provided acceptance callback
48
-     * @return array
49
-     */
50
-    public function getFiltered()
51
-    {
52
-        $filtered_array = array();
53
-        $this->rewind();
54
-        foreach ($this as $filtered_object) {
55
-            $filtered_array[] = $filtered_object;
56
-        }
57
-        return $filtered_array;
58
-    }
12
+	/**
13
+	 * Used for determining whether the iterated object in the Collection is "valid" or not.
14
+	 * @var Closure
15
+	 */
16
+	private $acceptance_callback;
17
+
18
+
19
+	/**
20
+	 * CollectionFilterCallbackIterator constructor.
21
+	 *
22
+	 * @param Collection $collection
23
+	 * @param Closure    $acceptance_callback  The closure will receive an instance of whatever object is stored on the
24
+	 *                                         collection when iterating over the collection and should return boolean.
25
+	 */
26
+	public function __construct(Collection $collection, Closure $acceptance_callback)
27
+	{
28
+		$this->acceptance_callback = $acceptance_callback;
29
+		parent::__construct($collection);
30
+	}
31
+
32
+	/**
33
+	 * Check whether the current element of the iterator is acceptable
34
+	 *
35
+	 * @link  http://php.net/manual/en/filteriterator.accept.php
36
+	 * @return bool true if the current element is acceptable, otherwise false.
37
+	 */
38
+	public function accept()
39
+	{
40
+		$acceptance_callback = $this->acceptance_callback;
41
+		return $acceptance_callback($this->getInnerIterator()->current());
42
+	}
43
+
44
+
45
+
46
+	/**
47
+	 * Returns a filtered array of objects from the collection using the provided acceptance callback
48
+	 * @return array
49
+	 */
50
+	public function getFiltered()
51
+	{
52
+		$filtered_array = array();
53
+		$this->rewind();
54
+		foreach ($this as $filtered_object) {
55
+			$filtered_array[] = $filtered_object;
56
+		}
57
+		return $filtered_array;
58
+	}
59 59
 }
Please login to merge, or discard this patch.
core/services/helpers/datetime/HelperInterface.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -16,94 +16,94 @@
 block discarded – undo
16 16
 interface HelperInterface
17 17
 {
18 18
 
19
-    /**
20
-     * Ensures that a valid timezone string is returned.
21
-     *
22
-     * @param string $timezone_string  When not provided then attempt to use the timezone_string set in the WP Time
23
-     *                                 settings (or derive from set UTC offset).
24
-     * @return string
25
-     */
26
-    public function getValidTimezoneString($timezone_string = '');
27
-
28
-
29
-    /**
30
-     * The only purpose for this static method is to validate that the incoming timezone is a valid php timezone.
31
-     *
32
-     * @param string $timezone_string
33
-     * @param bool   $throw_error
34
-     * @return bool
35
-     */
36
-    public function validateTimezone($timezone_string, $throw_error = true);
37
-
38
-
39
-    /**
40
-     * Returns a timezone string for the provided gmt_offset.
41
-     * @param float|string $gmt_offset
42
-     * @return string
43
-     */
44
-    public function getTimezoneStringFromGmtOffset($gmt_offset = '');
45
-
46
-
47
-    /**
48
-     * Gets the site's GMT offset based on either the timezone string
49
-     * (in which case the gmt offset will vary depending on the location's
50
-     * observance of daylight savings time) or the gmt_offset wp option
51
-     *
52
-     * @return int  seconds offset
53
-     */
54
-    public function getSiteTimezoneGmtOffset();
55
-
56
-
57
-    /**
58
-     * Get timezone transitions
59
-     * @param DateTimeZone $date_time_zone
60
-     * @param int|null     $time
61
-     * @param bool         $first_only
62
-     * @return array
63
-     */
64
-    public function getTimezoneTransitions(DateTimeZone $date_time_zone, $time = null, $first_only = true);
65
-
66
-
67
-    /**
68
-     * Get Timezone offset for given timezone object
69
-     * @param DateTimeZone $date_time_zone
70
-     * @param null|int         $time
71
-     * @return int
72
-     */
73
-    public function getTimezoneOffset(DateTimeZone $date_time_zone, $time = null);
74
-
75
-
76
-    /**
77
-     * Provide a timezone select input
78
-     * @param string $timezone_string
79
-     * @return string
80
-     */
81
-    public function timezoneSelectInput($timezone_string = '');
82
-
83
-
84
-    /**
85
-     * This method will take an incoming unix timestamp and add the offset to it for the given timezone_string.
86
-     * If no unix timestamp is given then time() is used.  If no timezone is given then the set timezone string for
87
-     * the site is used.
88
-     * This is used typically when using a Unix timestamp any core WP functions that expect their specially
89
-     * computed timestamp (i.e. date_i18n() )
90
-     *
91
-     * @param int    $unix_timestamp    if 0, then time() will be used.
92
-     * @param string $timezone_string timezone_string. If empty, then the current set timezone for the
93
-     *                                site will be used.
94
-     * @return int      unix_timestamp value with the offset applied for the given timezone.
95
-     */
96
-    public function getTimestampWithOffset($unix_timestamp = 0, $timezone_string = '');
97
-
98
-
99
-    /**
100
-     * Depending on PHP version,
101
-     * there might not be valid current timezone strings to match these gmt_offsets in its timezone tables.
102
-     * To get around that, for these fringe timezones we bump them to a known valid offset.
103
-     * This method should ONLY be called after first verifying an timezone_string cannot be retrieved for the offset.
104
-     *
105
-     * @param int $gmt_offset
106
-     * @return int
107
-     */
108
-    public function adjustInvalidGmtOffsets($gmt_offset);
19
+	/**
20
+	 * Ensures that a valid timezone string is returned.
21
+	 *
22
+	 * @param string $timezone_string  When not provided then attempt to use the timezone_string set in the WP Time
23
+	 *                                 settings (or derive from set UTC offset).
24
+	 * @return string
25
+	 */
26
+	public function getValidTimezoneString($timezone_string = '');
27
+
28
+
29
+	/**
30
+	 * The only purpose for this static method is to validate that the incoming timezone is a valid php timezone.
31
+	 *
32
+	 * @param string $timezone_string
33
+	 * @param bool   $throw_error
34
+	 * @return bool
35
+	 */
36
+	public function validateTimezone($timezone_string, $throw_error = true);
37
+
38
+
39
+	/**
40
+	 * Returns a timezone string for the provided gmt_offset.
41
+	 * @param float|string $gmt_offset
42
+	 * @return string
43
+	 */
44
+	public function getTimezoneStringFromGmtOffset($gmt_offset = '');
45
+
46
+
47
+	/**
48
+	 * Gets the site's GMT offset based on either the timezone string
49
+	 * (in which case the gmt offset will vary depending on the location's
50
+	 * observance of daylight savings time) or the gmt_offset wp option
51
+	 *
52
+	 * @return int  seconds offset
53
+	 */
54
+	public function getSiteTimezoneGmtOffset();
55
+
56
+
57
+	/**
58
+	 * Get timezone transitions
59
+	 * @param DateTimeZone $date_time_zone
60
+	 * @param int|null     $time
61
+	 * @param bool         $first_only
62
+	 * @return array
63
+	 */
64
+	public function getTimezoneTransitions(DateTimeZone $date_time_zone, $time = null, $first_only = true);
65
+
66
+
67
+	/**
68
+	 * Get Timezone offset for given timezone object
69
+	 * @param DateTimeZone $date_time_zone
70
+	 * @param null|int         $time
71
+	 * @return int
72
+	 */
73
+	public function getTimezoneOffset(DateTimeZone $date_time_zone, $time = null);
74
+
75
+
76
+	/**
77
+	 * Provide a timezone select input
78
+	 * @param string $timezone_string
79
+	 * @return string
80
+	 */
81
+	public function timezoneSelectInput($timezone_string = '');
82
+
83
+
84
+	/**
85
+	 * This method will take an incoming unix timestamp and add the offset to it for the given timezone_string.
86
+	 * If no unix timestamp is given then time() is used.  If no timezone is given then the set timezone string for
87
+	 * the site is used.
88
+	 * This is used typically when using a Unix timestamp any core WP functions that expect their specially
89
+	 * computed timestamp (i.e. date_i18n() )
90
+	 *
91
+	 * @param int    $unix_timestamp    if 0, then time() will be used.
92
+	 * @param string $timezone_string timezone_string. If empty, then the current set timezone for the
93
+	 *                                site will be used.
94
+	 * @return int      unix_timestamp value with the offset applied for the given timezone.
95
+	 */
96
+	public function getTimestampWithOffset($unix_timestamp = 0, $timezone_string = '');
97
+
98
+
99
+	/**
100
+	 * Depending on PHP version,
101
+	 * there might not be valid current timezone strings to match these gmt_offsets in its timezone tables.
102
+	 * To get around that, for these fringe timezones we bump them to a known valid offset.
103
+	 * This method should ONLY be called after first verifying an timezone_string cannot be retrieved for the offset.
104
+	 *
105
+	 * @param int $gmt_offset
106
+	 * @return int
107
+	 */
108
+	public function adjustInvalidGmtOffsets($gmt_offset);
109 109
 }
Please login to merge, or discard this patch.
core/domain/entities/contexts/ContextInterface.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 interface ContextInterface
19 19
 {
20 20
 
21
-    /**
22
-     * @return string
23
-     */
24
-    public function slug();
21
+	/**
22
+	 * @return string
23
+	 */
24
+	public function slug();
25 25
 
26 26
 
27
-    /**
28
-     * @return string
29
-     */
30
-    public function description();
27
+	/**
28
+	 * @return string
29
+	 */
30
+	public function description();
31 31
 }
Please login to merge, or discard this patch.
core/domain/services/factories/CartFactory.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@
 block discarded – undo
23 23
 class CartFactory
24 24
 {
25 25
 
26
-    /**
27
-     * @return EE_Cart
28
-     * @throws InvalidArgumentException
29
-     * @throws InvalidInterfaceException
30
-     * @throws InvalidDataTypeException
31
-     */
32
-    public static function getCart()
33
-    {
34
-        return LoaderFactory::getLoader()->getShared('EE_Cart');
35
-    }
26
+	/**
27
+	 * @return EE_Cart
28
+	 * @throws InvalidArgumentException
29
+	 * @throws InvalidInterfaceException
30
+	 * @throws InvalidDataTypeException
31
+	 */
32
+	public static function getCart()
33
+	{
34
+		return LoaderFactory::getLoader()->getShared('EE_Cart');
35
+	}
36 36
 }
Please login to merge, or discard this patch.
core/domain/services/factories/ModelFactory.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
25 25
 class ModelFactory
26 26
 {
27 27
 
28
-    /**
29
-     * @param string $model_name
30
-     * @return bool|EEM_Base
31
-     * @throws EE_Error
32
-     * @throws InvalidDataTypeException
33
-     * @throws InvalidInterfaceException
34
-     * @throws InvalidArgumentException
35
-     * @throws ReflectionException
36
-     */
37
-    public static function getModel($model_name)
38
-    {
39
-        return EE_Registry::instance()->load_model($model_name);
40
-    }
28
+	/**
29
+	 * @param string $model_name
30
+	 * @return bool|EEM_Base
31
+	 * @throws EE_Error
32
+	 * @throws InvalidDataTypeException
33
+	 * @throws InvalidInterfaceException
34
+	 * @throws InvalidArgumentException
35
+	 * @throws ReflectionException
36
+	 */
37
+	public static function getModel($model_name)
38
+	{
39
+		return EE_Registry::instance()->load_model($model_name);
40
+	}
41 41
 }
Please login to merge, or discard this patch.
modules/ticket_selector/TicketDatetimeAvailabilityTracker.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
     public function ticketDatetimeAvailability(EE_Ticket $ticket, $get_original_ticket_spaces = false)
67 67
     {
68 68
         // if the $_available_spaces array has not been set up yet...
69
-        if (! isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
69
+        if ( ! isset($this->available_spaces['tickets'][$ticket->ID()])) {
70 70
             $this->setInitialTicketDatetimeAvailability($ticket);
71 71
         }
72 72
         $available_spaces = $ticket->qty() - $ticket->sold();
73
-        if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
73
+        if (isset($this->available_spaces['tickets'][$ticket->ID()])) {
74 74
             // loop thru tickets, which will ALSO include individual ticket records AND a total
75
-            foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) {
75
+            foreach ($this->available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
76 76
                 // if we want the original datetime availability BEFORE we started subtracting tickets ?
77 77
                 if ($get_original_ticket_spaces) {
78 78
                     // then grab the available spaces from the "tickets" array
79 79
                     // and compare with the above to get the lowest number
80 80
                     $available_spaces = min(
81 81
                         $available_spaces,
82
-                        $this->available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ]
82
+                        $this->available_spaces['tickets'][$ticket->ID()][$DTD_ID]
83 83
                     );
84 84
                 } else {
85 85
                     // we want the updated ticket availability as stored in the "datetimes" array
86
-                    $available_spaces = min($available_spaces, $this->available_spaces['datetimes'][ $DTD_ID ]);
86
+                    $available_spaces = min($available_spaces, $this->available_spaces['datetimes'][$DTD_ID]);
87 87
                 }
88 88
             }
89 89
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 'order_by' => array('DTT_EVT_start' => 'ASC'),
115 115
             )
116 116
         );
117
-        if (! empty($datetimes)) {
117
+        if ( ! empty($datetimes)) {
118 118
             // now loop thru all of the datetimes
119 119
             foreach ($datetimes as $datetime) {
120 120
                 if ($datetime instanceof EE_Datetime) {
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
                     $spaces_remaining = $datetime->spaces_remaining();
123 123
                     // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold
124 124
                     // or the datetime spaces remaining) to this ticket using the datetime ID as the key
125
-                    $this->available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(
125
+                    $this->available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(
126 126
                         $ticket->qty() - $ticket->sold(),
127 127
                         $spaces_remaining
128 128
                     );
129 129
                     // if the remaining spaces for this datetime is already set,
130 130
                     // then compare that against the datetime spaces remaining, and take the lowest number,
131 131
                     // else just take the datetime spaces remaining, and assign to the datetimes array
132
-                    $this->available_spaces['datetimes'][ $datetime->ID() ] = isset(
133
-                        $this->available_spaces['datetimes'][ $datetime->ID() ]
132
+                    $this->available_spaces['datetimes'][$datetime->ID()] = isset(
133
+                        $this->available_spaces['datetimes'][$datetime->ID()]
134 134
                     )
135
-                        ? min($this->available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining)
135
+                        ? min($this->available_spaces['datetimes'][$datetime->ID()], $spaces_remaining)
136 136
                         : $spaces_remaining;
137 137
                 }
138 138
             }
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function recalculateTicketDatetimeAvailability(EE_Ticket $ticket, $qty = 0)
150 150
     {
151
-        if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
151
+        if (isset($this->available_spaces['tickets'][$ticket->ID()])) {
152 152
             // loop thru tickets, which will ALSO include individual ticket records AND a total
153
-            foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) {
153
+            foreach ($this->available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
154 154
                 // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
155
-                $this->available_spaces['datetimes'][ $DTD_ID ] -= $qty;
155
+                $this->available_spaces['datetimes'][$DTD_ID] -= $qty;
156 156
             }
157 157
         }
158 158
     }
Please login to merge, or discard this patch.
Indentation   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -22,217 +22,217 @@
 block discarded – undo
22 22
 class TicketDatetimeAvailabilityTracker
23 23
 {
24 24
 
25
-    /**
26
-     * array of datetimes and the spaces available for them
27
-     *
28
-     * @var array[][]
29
-     */
30
-    private $available_spaces = array();
31
-
32
-    /**
33
-     * @var EEM_Datetime $datetime_model
34
-     */
35
-    private $datetime_model;
36
-
37
-
38
-    /**
39
-     * TicketDatetimeAvailabilityTracker constructor.
40
-     *
41
-     * @param EEM_Datetime $datetime_model
42
-     */
43
-    public function __construct(EEM_Datetime $datetime_model)
44
-    {
45
-        $this->datetime_model = $datetime_model;
46
-    }
47
-
48
-
49
-    /**
50
-     * ticketDatetimeAvailability
51
-     * creates an array of tickets plus all of the datetimes available to each ticket
52
-     * and tracks the spaces remaining for each of those datetimes
53
-     *
54
-     * @param EE_Ticket $ticket - selected ticket
55
-     * @param bool      $get_original_ticket_spaces
56
-     * @return int
57
-     * @throws EE_Error
58
-     * @throws InvalidArgumentException
59
-     * @throws InvalidDataTypeException
60
-     * @throws InvalidInterfaceException
61
-     */
62
-    public function ticketDatetimeAvailability(EE_Ticket $ticket, $get_original_ticket_spaces = false)
63
-    {
64
-        // if the $_available_spaces array has not been set up yet...
65
-        if (! isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
66
-            $this->setInitialTicketDatetimeAvailability($ticket);
67
-        }
68
-        $available_spaces = $ticket->qty() - $ticket->sold();
69
-        if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
70
-            // loop thru tickets, which will ALSO include individual ticket records AND a total
71
-            foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) {
72
-                // if we want the original datetime availability BEFORE we started subtracting tickets ?
73
-                if ($get_original_ticket_spaces) {
74
-                    // then grab the available spaces from the "tickets" array
75
-                    // and compare with the above to get the lowest number
76
-                    $available_spaces = min(
77
-                        $available_spaces,
78
-                        $this->available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ]
79
-                    );
80
-                } else {
81
-                    // we want the updated ticket availability as stored in the "datetimes" array
82
-                    $available_spaces = min($available_spaces, $this->available_spaces['datetimes'][ $DTD_ID ]);
83
-                }
84
-            }
85
-        }
86
-        return $available_spaces;
87
-    }
88
-
89
-
90
-    /**
91
-     * @param EE_Ticket $ticket
92
-     * @return void
93
-     * @throws InvalidArgumentException
94
-     * @throws InvalidInterfaceException
95
-     * @throws InvalidDataTypeException
96
-     * @throws EE_Error
97
-     */
98
-    private function setInitialTicketDatetimeAvailability(EE_Ticket $ticket)
99
-    {
100
-        // first, get all of the datetimes that are available to this ticket
101
-        $datetimes = $ticket->get_many_related(
102
-            'Datetime',
103
-            array(
104
-                array(
105
-                    'DTT_EVT_end' => array(
106
-                        '>=',
107
-                        $this->datetime_model->current_time_for_query('DTT_EVT_end'),
108
-                    ),
109
-                ),
110
-                'order_by' => array('DTT_EVT_start' => 'ASC'),
111
-            )
112
-        );
113
-        if (! empty($datetimes)) {
114
-            // now loop thru all of the datetimes
115
-            foreach ($datetimes as $datetime) {
116
-                if ($datetime instanceof EE_Datetime) {
117
-                    // the number of spaces available for the datetime without considering individual ticket quantities
118
-                    $spaces_remaining = $datetime->spaces_remaining();
119
-                    // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold
120
-                    // or the datetime spaces remaining) to this ticket using the datetime ID as the key
121
-                    $this->available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(
122
-                        $ticket->qty() - $ticket->sold(),
123
-                        $spaces_remaining
124
-                    );
125
-                    // if the remaining spaces for this datetime is already set,
126
-                    // then compare that against the datetime spaces remaining, and take the lowest number,
127
-                    // else just take the datetime spaces remaining, and assign to the datetimes array
128
-                    $this->available_spaces['datetimes'][ $datetime->ID() ] = isset(
129
-                        $this->available_spaces['datetimes'][ $datetime->ID() ]
130
-                    )
131
-                        ? min($this->available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining)
132
-                        : $spaces_remaining;
133
-                }
134
-            }
135
-        }
136
-    }
137
-
138
-
139
-    /**
140
-     * @param    EE_Ticket $ticket
141
-     * @param    int       $qty
142
-     * @return    void
143
-     * @throws EE_Error
144
-     */
145
-    public function recalculateTicketDatetimeAvailability(EE_Ticket $ticket, $qty = 0)
146
-    {
147
-        if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
148
-            // loop thru tickets, which will ALSO include individual ticket records AND a total
149
-            foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) {
150
-                // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
151
-                $this->available_spaces['datetimes'][ $DTD_ID ] -= $qty;
152
-            }
153
-        }
154
-    }
155
-
156
-
157
-    /**
158
-     * @param EE_Ticket $ticket
159
-     * @param           $qty
160
-     * @param int       $total_ticket_count
161
-     * @throws EE_Error
162
-     * @throws InvalidArgumentException
163
-     * @throws InvalidDataTypeException
164
-     * @throws InvalidInterfaceException
165
-     */
166
-    public function processAvailabilityError(EE_Ticket $ticket, $qty, $total_ticket_count = 1)
167
-    {
168
-        // tickets can not be purchased but let's find the exact number left
169
-        // for the last ticket selected PRIOR to subtracting tickets
170
-        $available_spaces = $this->ticketDatetimeAvailability($ticket, true);
171
-        // greedy greedy greedy eh?
172
-        if ($available_spaces > 0) {
173
-            if (
174
-                apply_filters(
175
-                    'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error',
176
-                    true,
177
-                    $ticket,
178
-                    $qty,
179
-                    $available_spaces
180
-                )
181
-            ) {
182
-                $this->availabilityError(
183
-                    $available_spaces,
184
-                    $total_ticket_count
185
-                );
186
-            }
187
-        } else {
188
-            EE_Error::add_error(
189
-                esc_html__(
190
-                    'We\'re sorry, but there are no available spaces left for this event at this particular date and time.',
191
-                    'event_espresso'
192
-                ),
193
-                __FILE__,
194
-                __FUNCTION__,
195
-                __LINE__
196
-            );
197
-        }
198
-    }
199
-
200
-
201
-    /**
202
-     * @param int $available_spaces
203
-     * @param int $total_ticket_count
204
-     */
205
-    private function availabilityError($available_spaces = 1, $total_ticket_count = 1)
206
-    {
207
-        // add error messaging - we're using the _n function that will generate
208
-        // the appropriate singular or plural message based on the number of $available_spaces
209
-        if ($total_ticket_count) {
210
-            $msg = sprintf(
211
-                esc_html(
212
-                    _n(
213
-                        'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.',
214
-                        'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.',
215
-                        $available_spaces,
216
-                        'event_espresso'
217
-                    )
218
-                ),
219
-                $available_spaces,
220
-                '<br />'
221
-            );
222
-        } else {
223
-            $msg = sprintf(
224
-                esc_html(
225
-                    _n(
226
-                        'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets.',
227
-                        'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets.',
228
-                        $available_spaces,
229
-                        'event_espresso'
230
-                    )
231
-                ),
232
-                $available_spaces,
233
-                '<br />'
234
-            );
235
-        }
236
-        EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
237
-    }
25
+	/**
26
+	 * array of datetimes and the spaces available for them
27
+	 *
28
+	 * @var array[][]
29
+	 */
30
+	private $available_spaces = array();
31
+
32
+	/**
33
+	 * @var EEM_Datetime $datetime_model
34
+	 */
35
+	private $datetime_model;
36
+
37
+
38
+	/**
39
+	 * TicketDatetimeAvailabilityTracker constructor.
40
+	 *
41
+	 * @param EEM_Datetime $datetime_model
42
+	 */
43
+	public function __construct(EEM_Datetime $datetime_model)
44
+	{
45
+		$this->datetime_model = $datetime_model;
46
+	}
47
+
48
+
49
+	/**
50
+	 * ticketDatetimeAvailability
51
+	 * creates an array of tickets plus all of the datetimes available to each ticket
52
+	 * and tracks the spaces remaining for each of those datetimes
53
+	 *
54
+	 * @param EE_Ticket $ticket - selected ticket
55
+	 * @param bool      $get_original_ticket_spaces
56
+	 * @return int
57
+	 * @throws EE_Error
58
+	 * @throws InvalidArgumentException
59
+	 * @throws InvalidDataTypeException
60
+	 * @throws InvalidInterfaceException
61
+	 */
62
+	public function ticketDatetimeAvailability(EE_Ticket $ticket, $get_original_ticket_spaces = false)
63
+	{
64
+		// if the $_available_spaces array has not been set up yet...
65
+		if (! isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
66
+			$this->setInitialTicketDatetimeAvailability($ticket);
67
+		}
68
+		$available_spaces = $ticket->qty() - $ticket->sold();
69
+		if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
70
+			// loop thru tickets, which will ALSO include individual ticket records AND a total
71
+			foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) {
72
+				// if we want the original datetime availability BEFORE we started subtracting tickets ?
73
+				if ($get_original_ticket_spaces) {
74
+					// then grab the available spaces from the "tickets" array
75
+					// and compare with the above to get the lowest number
76
+					$available_spaces = min(
77
+						$available_spaces,
78
+						$this->available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ]
79
+					);
80
+				} else {
81
+					// we want the updated ticket availability as stored in the "datetimes" array
82
+					$available_spaces = min($available_spaces, $this->available_spaces['datetimes'][ $DTD_ID ]);
83
+				}
84
+			}
85
+		}
86
+		return $available_spaces;
87
+	}
88
+
89
+
90
+	/**
91
+	 * @param EE_Ticket $ticket
92
+	 * @return void
93
+	 * @throws InvalidArgumentException
94
+	 * @throws InvalidInterfaceException
95
+	 * @throws InvalidDataTypeException
96
+	 * @throws EE_Error
97
+	 */
98
+	private function setInitialTicketDatetimeAvailability(EE_Ticket $ticket)
99
+	{
100
+		// first, get all of the datetimes that are available to this ticket
101
+		$datetimes = $ticket->get_many_related(
102
+			'Datetime',
103
+			array(
104
+				array(
105
+					'DTT_EVT_end' => array(
106
+						'>=',
107
+						$this->datetime_model->current_time_for_query('DTT_EVT_end'),
108
+					),
109
+				),
110
+				'order_by' => array('DTT_EVT_start' => 'ASC'),
111
+			)
112
+		);
113
+		if (! empty($datetimes)) {
114
+			// now loop thru all of the datetimes
115
+			foreach ($datetimes as $datetime) {
116
+				if ($datetime instanceof EE_Datetime) {
117
+					// the number of spaces available for the datetime without considering individual ticket quantities
118
+					$spaces_remaining = $datetime->spaces_remaining();
119
+					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold
120
+					// or the datetime spaces remaining) to this ticket using the datetime ID as the key
121
+					$this->available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(
122
+						$ticket->qty() - $ticket->sold(),
123
+						$spaces_remaining
124
+					);
125
+					// if the remaining spaces for this datetime is already set,
126
+					// then compare that against the datetime spaces remaining, and take the lowest number,
127
+					// else just take the datetime spaces remaining, and assign to the datetimes array
128
+					$this->available_spaces['datetimes'][ $datetime->ID() ] = isset(
129
+						$this->available_spaces['datetimes'][ $datetime->ID() ]
130
+					)
131
+						? min($this->available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining)
132
+						: $spaces_remaining;
133
+				}
134
+			}
135
+		}
136
+	}
137
+
138
+
139
+	/**
140
+	 * @param    EE_Ticket $ticket
141
+	 * @param    int       $qty
142
+	 * @return    void
143
+	 * @throws EE_Error
144
+	 */
145
+	public function recalculateTicketDatetimeAvailability(EE_Ticket $ticket, $qty = 0)
146
+	{
147
+		if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) {
148
+			// loop thru tickets, which will ALSO include individual ticket records AND a total
149
+			foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) {
150
+				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
151
+				$this->available_spaces['datetimes'][ $DTD_ID ] -= $qty;
152
+			}
153
+		}
154
+	}
155
+
156
+
157
+	/**
158
+	 * @param EE_Ticket $ticket
159
+	 * @param           $qty
160
+	 * @param int       $total_ticket_count
161
+	 * @throws EE_Error
162
+	 * @throws InvalidArgumentException
163
+	 * @throws InvalidDataTypeException
164
+	 * @throws InvalidInterfaceException
165
+	 */
166
+	public function processAvailabilityError(EE_Ticket $ticket, $qty, $total_ticket_count = 1)
167
+	{
168
+		// tickets can not be purchased but let's find the exact number left
169
+		// for the last ticket selected PRIOR to subtracting tickets
170
+		$available_spaces = $this->ticketDatetimeAvailability($ticket, true);
171
+		// greedy greedy greedy eh?
172
+		if ($available_spaces > 0) {
173
+			if (
174
+				apply_filters(
175
+					'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error',
176
+					true,
177
+					$ticket,
178
+					$qty,
179
+					$available_spaces
180
+				)
181
+			) {
182
+				$this->availabilityError(
183
+					$available_spaces,
184
+					$total_ticket_count
185
+				);
186
+			}
187
+		} else {
188
+			EE_Error::add_error(
189
+				esc_html__(
190
+					'We\'re sorry, but there are no available spaces left for this event at this particular date and time.',
191
+					'event_espresso'
192
+				),
193
+				__FILE__,
194
+				__FUNCTION__,
195
+				__LINE__
196
+			);
197
+		}
198
+	}
199
+
200
+
201
+	/**
202
+	 * @param int $available_spaces
203
+	 * @param int $total_ticket_count
204
+	 */
205
+	private function availabilityError($available_spaces = 1, $total_ticket_count = 1)
206
+	{
207
+		// add error messaging - we're using the _n function that will generate
208
+		// the appropriate singular or plural message based on the number of $available_spaces
209
+		if ($total_ticket_count) {
210
+			$msg = sprintf(
211
+				esc_html(
212
+					_n(
213
+						'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.',
214
+						'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.',
215
+						$available_spaces,
216
+						'event_espresso'
217
+					)
218
+				),
219
+				$available_spaces,
220
+				'<br />'
221
+			);
222
+		} else {
223
+			$msg = sprintf(
224
+				esc_html(
225
+					_n(
226
+						'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets.',
227
+						'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets.',
228
+						$available_spaces,
229
+						'event_espresso'
230
+					)
231
+				),
232
+				$available_spaces,
233
+				'<br />'
234
+			);
235
+		}
236
+		EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
237
+	}
238 238
 }
Please login to merge, or discard this patch.