Completed
Branch BUG/11214/move-command-handler... (de017e)
by
unknown
04:20 queued 02:32
created
core/services/container/ContainerInterface.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,26 +18,26 @@  discard block
 block discarded – undo
18 18
 interface ContainerInterface
19 19
 {
20 20
 
21
-    /**
22
-     * Finds an entry of the container by its identifier and returns it.
23
-     *
24
-     * @param string $id Identifier of the entry to look for.
25
-     * @return mixed Entry.
26
-     */
27
-    public function get($id);
28
-
29
-
30
-
31
-    /**
32
-     * Returns true if the container can return an entry for the given identifier.
33
-     * Returns false otherwise.
34
-     * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
35
-     * It does however mean that `get($id)` will not throw a `NotFoundException`.
36
-     *
37
-     * @param string $id Identifier of the entry to look for.
38
-     * @return boolean
39
-     */
40
-    public function has($id);
21
+	/**
22
+	 * Finds an entry of the container by its identifier and returns it.
23
+	 *
24
+	 * @param string $id Identifier of the entry to look for.
25
+	 * @return mixed Entry.
26
+	 */
27
+	public function get($id);
28
+
29
+
30
+
31
+	/**
32
+	 * Returns true if the container can return an entry for the given identifier.
33
+	 * Returns false otherwise.
34
+	 * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
35
+	 * It does however mean that `get($id)` will not throw a `NotFoundException`.
36
+	 *
37
+	 * @param string $id Identifier of the entry to look for.
38
+	 * @return boolean
39
+	 */
40
+	public function has($id);
41 41
 
42 42
 
43 43
 }
Please login to merge, or discard this patch.
core/services/container/CoffeeMakerInterface.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 interface CoffeeMakerInterface
18 18
 {
19 19
 
20
-    /**
21
-     * @return array
22
-     */
23
-    public static function getTypes();
20
+	/**
21
+	 * @return array
22
+	 */
23
+	public static function getTypes();
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     * @param $type
29
-     */
30
-    public static function validateType($type);
27
+	/**
28
+	 * @param $type
29
+	 */
30
+	public static function validateType($type);
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * @param RecipeInterface $recipe
36
-     * @param array           $arguments
37
-     * @return mixed
38
-     */
39
-    public function brew(RecipeInterface $recipe, $arguments = array());
34
+	/**
35
+	 * @param RecipeInterface $recipe
36
+	 * @param array           $arguments
37
+	 * @return mixed
38
+	 */
39
+	public function brew(RecipeInterface $recipe, $arguments = array());
40 40
 
41 41
 
42 42
 
43
-    /**
44
-     * @return string
45
-     */
46
-    public function type();
43
+	/**
44
+	 * @return string
45
+	 */
46
+	public function type();
47 47
 
48 48
 }
49 49
 // End of file CoffeeMakerInterface.php
Please login to merge, or discard this patch.
core/services/container/exceptions/InstantiationException.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use BadMethodCallException;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
 class InstantiationException extends BadMethodCallException
21 21
 {
22 22
 
23
-    /**
24
-     * InstantiationException constructor.
25
-     *
26
-     * @param string $identifier the name of the requested entity or service
27
-     * @param string     $message
28
-     * @param int        $code
29
-     * @param \Exception $previous
30
-     */
31
-    public function __construct($identifier, $message = '', $code = 0, \Exception $previous = null)
32
-    {
33
-        if (empty($message)) {
34
-            $message = sprintf(
35
-                __(
36
-                    'The "%1$s" class could not be constructed.',
37
-                    'event_espresso'
38
-                ),
39
-                $identifier
40
-            );
41
-        }
42
-        parent::__construct($message, $code, $previous);
43
-    }
23
+	/**
24
+	 * InstantiationException constructor.
25
+	 *
26
+	 * @param string $identifier the name of the requested entity or service
27
+	 * @param string     $message
28
+	 * @param int        $code
29
+	 * @param \Exception $previous
30
+	 */
31
+	public function __construct($identifier, $message = '', $code = 0, \Exception $previous = null)
32
+	{
33
+		if (empty($message)) {
34
+			$message = sprintf(
35
+				__(
36
+					'The "%1$s" class could not be constructed.',
37
+					'event_espresso'
38
+				),
39
+				$identifier
40
+			);
41
+		}
42
+		parent::__construct($message, $code, $previous);
43
+	}
44 44
 
45 45
 }
46 46
 // End of file InstantiationException.php
Please login to merge, or discard this patch.
core/services/container/CoffeePotInterface.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,70 +18,70 @@  discard block
 block discarded – undo
18 18
 
19 19
 
20 20
 
21
-    /**
22
-     * returns an instance of the requested entity type using the supplied arguments.
23
-     * If a shared service is requested and an instance is already in the carafe, then it will be returned.
24
-     * If it is not already in the carafe, then the service will be constructed, added to the carafe, and returned
25
-     * If the request is for a new entity and a closure exists in the reservoir for creating it,
26
-     * then a new entity will be instantiated from the closure and returned.
27
-     * If a closure does not exist, then one will be built and added to the reservoir
28
-     * before instantiating the requested entity.
29
-     *
30
-     * @param  string $identifier Identifier for the entity class to be constructed.
31
-     *                            Typically a Fully Qualified Class Name
32
-     * @param array   $arguments  an array of arguments to be passed to the entity constructor
33
-     * @param string  $type
34
-     * @return mixed
35
-     */
36
-    public function brew($identifier, $arguments = array(), $type = '');
21
+	/**
22
+	 * returns an instance of the requested entity type using the supplied arguments.
23
+	 * If a shared service is requested and an instance is already in the carafe, then it will be returned.
24
+	 * If it is not already in the carafe, then the service will be constructed, added to the carafe, and returned
25
+	 * If the request is for a new entity and a closure exists in the reservoir for creating it,
26
+	 * then a new entity will be instantiated from the closure and returned.
27
+	 * If a closure does not exist, then one will be built and added to the reservoir
28
+	 * before instantiating the requested entity.
29
+	 *
30
+	 * @param  string $identifier Identifier for the entity class to be constructed.
31
+	 *                            Typically a Fully Qualified Class Name
32
+	 * @param array   $arguments  an array of arguments to be passed to the entity constructor
33
+	 * @param string  $type
34
+	 * @return mixed
35
+	 */
36
+	public function brew($identifier, $arguments = array(), $type = '');
37 37
 
38 38
 
39 39
 
40
-    /**
41
-     * @param string   $identifier
42
-     * @param callable $closure
43
-     */
44
-    public function addClosure($identifier, $closure);
40
+	/**
41
+	 * @param string   $identifier
42
+	 * @param callable $closure
43
+	 */
44
+	public function addClosure($identifier, $closure);
45 45
 
46 46
 
47 47
 
48
-    /**
49
-     * @param string $identifier
50
-     * @param mixed  $service
51
-     * @return boolean
52
-     */
53
-    public function addService($identifier, $service);
48
+	/**
49
+	 * @param string $identifier
50
+	 * @param mixed  $service
51
+	 * @return boolean
52
+	 */
53
+	public function addService($identifier, $service);
54 54
 
55 55
 
56 56
 
57
-    /**
58
-     * Adds instructions on how to brew objects
59
-     *
60
-     * @param RecipeInterface $recipe
61
-     * @return mixed
62
-     */
63
-    public function addRecipe(RecipeInterface $recipe);
57
+	/**
58
+	 * Adds instructions on how to brew objects
59
+	 *
60
+	 * @param RecipeInterface $recipe
61
+	 * @return mixed
62
+	 */
63
+	public function addRecipe(RecipeInterface $recipe);
64 64
 
65 65
 
66 66
 
67
-    /**
68
-     * Get instructions on how to brew objects
69
-     *
70
-     * @param string $identifier
71
-     * @return Recipe
72
-     */
73
-    public function getRecipe($identifier);
67
+	/**
68
+	 * Get instructions on how to brew objects
69
+	 *
70
+	 * @param string $identifier
71
+	 * @return Recipe
72
+	 */
73
+	public function getRecipe($identifier);
74 74
 
75 75
 
76 76
 
77
-    /**
78
-     * adds class name aliases to list of filters
79
-     *
80
-     * @param  string $identifier
81
-     * @param  array  $aliases
82
-     * @return string
83
-     */
84
-    public function addAliases($identifier, $aliases);
77
+	/**
78
+	 * adds class name aliases to list of filters
79
+	 *
80
+	 * @param  string $identifier
81
+	 * @param  array  $aliases
82
+	 * @return string
83
+	 */
84
+	public function addAliases($identifier, $aliases);
85 85
 
86 86
 
87 87
 
Please login to merge, or discard this patch.
core/services/container/CoffeeMaker.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      */
57 57
     public static function getTypes()
58 58
     {
59
-        return (array)apply_filters(
59
+        return (array) apply_filters(
60 60
             'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes',
61 61
             array(
62 62
                 CoffeeMaker::BREW_NEW,
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\services\container\exceptions\InstantiationException;
7 7
 
8 8
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
-    exit('No direct script access allowed');
9
+	exit('No direct script access allowed');
10 10
 }
11 11
 
12 12
 
@@ -23,162 +23,162 @@  discard block
 block discarded – undo
23 23
 abstract class CoffeeMaker implements CoffeeMakerInterface
24 24
 {
25 25
 
26
-    /**
27
-     * Indicates that CoffeeMaker should construct a NEW entity instance from the provided arguments (if given)
28
-     */
29
-    const BREW_NEW = 'new';
30
-
31
-    /**
32
-     * Indicates that CoffeeMaker should always return a SHARED instance
33
-     */
34
-    const BREW_SHARED = 'shared';
35
-
36
-    /**
37
-     * Indicates that CoffeeMaker should only load the file/class/interface but NOT instantiate
38
-     */
39
-    const BREW_LOAD_ONLY = 'load_only';
40
-
41
-
42
-    /**
43
-     * @var CoffeePotInterface $coffee_pot
44
-     */
45
-    private $coffee_pot;
46
-
47
-    /**
48
-     * @var DependencyInjector $injector
49
-     */
50
-    private $injector;
51
-
52
-
53
-
54
-    /**
55
-     * @return array
56
-     */
57
-    public static function getTypes()
58
-    {
59
-        return (array)apply_filters(
60
-            'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes',
61
-            array(
62
-                CoffeeMaker::BREW_NEW,
63
-                CoffeeMaker::BREW_SHARED,
64
-                CoffeeMaker::BREW_LOAD_ONLY,
65
-            )
66
-        );
67
-    }
68
-
69
-
70
-
71
-    /**
72
-     * @param $type
73
-     * @throws \EventEspresso\core\exceptions\InvalidIdentifierException
74
-     */
75
-    public static function validateType($type)
76
-    {
77
-        $types = CoffeeMaker::getTypes();
78
-        if ( ! in_array($type, $types, true)) {
79
-            throw new InvalidIdentifierException(
80
-                is_object($type) ? get_class($type) : gettype($type),
81
-                __(
82
-                    'recipe type (one of the class constants on \EventEspresso\core\services\container\CoffeeMaker)',
83
-                    'event_espresso'
84
-                )
85
-            );
86
-        }
87
-        return $type;
88
-    }
89
-
90
-
91
-
92
-    /**
93
-     * CoffeeMaker constructor.
94
-     *
95
-     * @param CoffeePotInterface $coffee_pot
96
-     * @param InjectorInterface  $injector
97
-     */
98
-    public function __construct(CoffeePotInterface $coffee_pot, InjectorInterface $injector)
99
-    {
100
-        $this->coffee_pot = $coffee_pot;
101
-        $this->injector = $injector;
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * @return \EventEspresso\core\services\container\CoffeePotInterface
108
-     */
109
-    protected function coffeePot()
110
-    {
111
-        return $this->coffee_pot;
112
-    }
113
-
114
-
115
-
116
-    /**
117
-     * @return \EventEspresso\core\services\container\DependencyInjector
118
-     */
119
-    protected function injector()
120
-    {
121
-        return $this->injector;
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * Examines the constructor to determine which method should be used for instantiation
128
-     *
129
-     * @param \ReflectionClass $reflector
130
-     * @return mixed
131
-     * @throws InstantiationException
132
-     */
133
-    protected function resolveInstantiationMethod(\ReflectionClass $reflector)
134
-    {
135
-        if ($reflector->getConstructor() === null) {
136
-            return 'NewInstance';
137
-        } else if ($reflector->isInstantiable()) {
138
-            return 'NewInstanceArgs';
139
-        } else if (method_exists($reflector->getName(), 'instance')) {
140
-            return 'instance';
141
-        } else if (method_exists($reflector->getName(), 'new_instance')) {
142
-            return 'new_instance';
143
-        } else if (method_exists($reflector->getName(), 'new_instance_from_db')) {
144
-            return 'new_instance_from_db';
145
-        } else {
146
-            throw new InstantiationException($reflector->getName());
147
-        }
148
-    }
149
-
150
-
151
-
152
-    /**
153
-     * Ensures files for classes that are not PSR-4 compatible are loaded
154
-     * and then verifies that classes exist where applicable
155
-     *
156
-     * @param RecipeInterface $recipe
157
-     * @return bool
158
-     * @throws InvalidClassException
159
-     */
160
-    protected function resolveClassAndFilepath(RecipeInterface $recipe)
161
-    {
162
-        $paths = $recipe->paths();
163
-        if ( ! empty($paths)) {
164
-            foreach ($paths as $path) {
165
-                if (strpos($path, '*') === false && is_readable($path)) {
166
-                    require_once($path);
167
-                }
168
-            }
169
-        }
170
-        // re: using "false" for class_exists() second param:
171
-        // if a class name is not already known to PHP, then class_exists() will run through
172
-        // all of the registered spl_autoload functions until it either finds the class,
173
-        // or gets to the end of the registered spl_autoload functions.
174
-        // When the second parameter is true, it will also attempt to load the class file,
175
-        // but it will also trigger an error if the class can not be loaded.
176
-        // We don't want that extra error in the mix, so we have set the second param to "false"
177
-        if ($recipe->type() !== CoffeeMaker::BREW_LOAD_ONLY && ! class_exists($recipe->fqcn(), false)) {
178
-            throw new InvalidClassException($recipe->identifier());
179
-        }
180
-        return true;
181
-    }
26
+	/**
27
+	 * Indicates that CoffeeMaker should construct a NEW entity instance from the provided arguments (if given)
28
+	 */
29
+	const BREW_NEW = 'new';
30
+
31
+	/**
32
+	 * Indicates that CoffeeMaker should always return a SHARED instance
33
+	 */
34
+	const BREW_SHARED = 'shared';
35
+
36
+	/**
37
+	 * Indicates that CoffeeMaker should only load the file/class/interface but NOT instantiate
38
+	 */
39
+	const BREW_LOAD_ONLY = 'load_only';
40
+
41
+
42
+	/**
43
+	 * @var CoffeePotInterface $coffee_pot
44
+	 */
45
+	private $coffee_pot;
46
+
47
+	/**
48
+	 * @var DependencyInjector $injector
49
+	 */
50
+	private $injector;
51
+
52
+
53
+
54
+	/**
55
+	 * @return array
56
+	 */
57
+	public static function getTypes()
58
+	{
59
+		return (array)apply_filters(
60
+			'FHEE__EventEspresso\core\services\container\CoffeeMaker__getTypes',
61
+			array(
62
+				CoffeeMaker::BREW_NEW,
63
+				CoffeeMaker::BREW_SHARED,
64
+				CoffeeMaker::BREW_LOAD_ONLY,
65
+			)
66
+		);
67
+	}
68
+
69
+
70
+
71
+	/**
72
+	 * @param $type
73
+	 * @throws \EventEspresso\core\exceptions\InvalidIdentifierException
74
+	 */
75
+	public static function validateType($type)
76
+	{
77
+		$types = CoffeeMaker::getTypes();
78
+		if ( ! in_array($type, $types, true)) {
79
+			throw new InvalidIdentifierException(
80
+				is_object($type) ? get_class($type) : gettype($type),
81
+				__(
82
+					'recipe type (one of the class constants on \EventEspresso\core\services\container\CoffeeMaker)',
83
+					'event_espresso'
84
+				)
85
+			);
86
+		}
87
+		return $type;
88
+	}
89
+
90
+
91
+
92
+	/**
93
+	 * CoffeeMaker constructor.
94
+	 *
95
+	 * @param CoffeePotInterface $coffee_pot
96
+	 * @param InjectorInterface  $injector
97
+	 */
98
+	public function __construct(CoffeePotInterface $coffee_pot, InjectorInterface $injector)
99
+	{
100
+		$this->coffee_pot = $coffee_pot;
101
+		$this->injector = $injector;
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * @return \EventEspresso\core\services\container\CoffeePotInterface
108
+	 */
109
+	protected function coffeePot()
110
+	{
111
+		return $this->coffee_pot;
112
+	}
113
+
114
+
115
+
116
+	/**
117
+	 * @return \EventEspresso\core\services\container\DependencyInjector
118
+	 */
119
+	protected function injector()
120
+	{
121
+		return $this->injector;
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * Examines the constructor to determine which method should be used for instantiation
128
+	 *
129
+	 * @param \ReflectionClass $reflector
130
+	 * @return mixed
131
+	 * @throws InstantiationException
132
+	 */
133
+	protected function resolveInstantiationMethod(\ReflectionClass $reflector)
134
+	{
135
+		if ($reflector->getConstructor() === null) {
136
+			return 'NewInstance';
137
+		} else if ($reflector->isInstantiable()) {
138
+			return 'NewInstanceArgs';
139
+		} else if (method_exists($reflector->getName(), 'instance')) {
140
+			return 'instance';
141
+		} else if (method_exists($reflector->getName(), 'new_instance')) {
142
+			return 'new_instance';
143
+		} else if (method_exists($reflector->getName(), 'new_instance_from_db')) {
144
+			return 'new_instance_from_db';
145
+		} else {
146
+			throw new InstantiationException($reflector->getName());
147
+		}
148
+	}
149
+
150
+
151
+
152
+	/**
153
+	 * Ensures files for classes that are not PSR-4 compatible are loaded
154
+	 * and then verifies that classes exist where applicable
155
+	 *
156
+	 * @param RecipeInterface $recipe
157
+	 * @return bool
158
+	 * @throws InvalidClassException
159
+	 */
160
+	protected function resolveClassAndFilepath(RecipeInterface $recipe)
161
+	{
162
+		$paths = $recipe->paths();
163
+		if ( ! empty($paths)) {
164
+			foreach ($paths as $path) {
165
+				if (strpos($path, '*') === false && is_readable($path)) {
166
+					require_once($path);
167
+				}
168
+			}
169
+		}
170
+		// re: using "false" for class_exists() second param:
171
+		// if a class name is not already known to PHP, then class_exists() will run through
172
+		// all of the registered spl_autoload functions until it either finds the class,
173
+		// or gets to the end of the registered spl_autoload functions.
174
+		// When the second parameter is true, it will also attempt to load the class file,
175
+		// but it will also trigger an error if the class can not be loaded.
176
+		// We don't want that extra error in the mix, so we have set the second param to "false"
177
+		if ($recipe->type() !== CoffeeMaker::BREW_LOAD_ONLY && ! class_exists($recipe->fqcn(), false)) {
178
+			throw new InvalidClassException($recipe->identifier());
179
+		}
180
+		return true;
181
+	}
182 182
 
183 183
 
184 184
 
Please login to merge, or discard this patch.
admin_pages/venues/templates/google_map.template.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
26 26
                     <input type="text" id="ee-google-map-api-key" class="regular-text" name="google_map_api_key" value="<?php echo $map_settings->google_map_api_key; ?>" />
27 27
                     <p class="description">
28 28
                         <?php
29
-                            printf(
30
-                                __('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'),
31
-                                '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">',
32
-                                '</a>'
33
-                            );
34
-                        ?>
29
+							printf(
30
+								__('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'),
31
+								'<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">',
32
+								'</a>'
33
+							);
34
+						?>
35 35
                     </p>
36 36
                 </td>
37 37
             </tr>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 				</td>
16 16
 			</tr>
17 17
 			<?php
18
-			if( apply_filters( 'FHEE__google_map__show_api_key_input', true ) ) { ?>
18
+			if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?>
19 19
             <tr>
20 20
                 <th>
21 21
                     <label for="ee-google-map-api-key">
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 				<td>
111 111
 					<label for="event_details_control_type-default" class="ee-admin-radio-lbl">
112 112
 						<?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' : ''; ?>
113
-						<input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked;?>/>
113
+						<input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked; ?>/>
114 114
 						<?php _e(' Default', 'event_espresso') ?>
115 115
 					</label>
116 116
 
117 117
 					<label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl">
118 118
 						<?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' : ''; ?>
119
-						<input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked;?>/>
119
+						<input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked; ?>/>
120 120
 						<?php _e(' Horizontal', 'event_espresso') ?>
121 121
 					</label>
122 122
 
123 123
 					<label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl">
124 124
 						<?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' : ''; ?>
125
-						<input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked;?>/>
125
+						<input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked; ?>/>
126 126
 						<?php _e(' Dropdown', 'event_espresso') ?>
127 127
 					</label>
128 128
 				</td>
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 				<td>
136 136
 					<label for="event_details_map_align-none" class="ee-admin-radio-lbl">
137 137
 						<?php $checked = $map_settings->event_details_map_align == 'none' ? 'checked="checked"' : ''; ?>
138
-						<input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked;?>/>
138
+						<input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked; ?>/>
139 139
 						<?php _e(' None', 'event_espresso') ?>
140 140
 					</label>
141 141
 
142 142
 					<label for="event_details_map_align-left" class="ee-admin-radio-lbl">
143 143
 						<?php $checked = $map_settings->event_details_map_align == 'left' ? 'checked="checked"' : ''; ?>
144
-						<input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked;?>/>
144
+						<input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked; ?>/>
145 145
 						<?php _e(' Align Left', 'event_espresso') ?>
146 146
 					</label>
147 147
 
148 148
 					<label for="event_details_map_align-center" class="ee-admin-radio-lbl">
149 149
 						<?php $checked = $map_settings->event_details_map_align == 'center' ? 'checked="checked"' : ''; ?>
150
-						<input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked;?>/>
150
+						<input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked; ?>/>
151 151
 						<?php _e(' Align Center', 'event_espresso') ?>
152 152
 					</label>
153 153
 
154 154
 					<label for="event_details_map_align-right" class="ee-admin-radio-lbl">
155 155
 						<?php $checked = $map_settings->event_details_map_align == 'right' ? 'checked="checked"' : ''; ?>
156
-						<input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked;?>/>
156
+						<input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked; ?>/>
157 157
 						<?php _e(' Align Right', 'event_espresso') ?>
158 158
 					</label>
159 159
 				</td>
@@ -228,19 +228,19 @@  discard block
 block discarded – undo
228 228
 				<td>
229 229
 					<label for="event_list_control_type-default" class="ee-admin-radio-lbl">
230 230
 						<?php $checked = $map_settings->event_list_control_type == 'default' ? 'checked="checked"' : ''; ?>
231
-						<input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked;?>/>
231
+						<input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked; ?>/>
232 232
 						<?php _e(' Default', 'event_espresso') ?>
233 233
 					</label>
234 234
 
235 235
 					<label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl">
236 236
 						<?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' : ''; ?>
237
-						<input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked;?>/>
237
+						<input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked; ?>/>
238 238
 						<?php _e(' Horizontal', 'event_espresso') ?>
239 239
 					</label>
240 240
 
241 241
 					<label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl">
242 242
 						<?php $checked = $map_settings->event_list_control_type == 'dropdown' ? 'checked="checked"' : ''; ?>
243
-						<input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked;?>/>
243
+						<input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked; ?>/>
244 244
 						<?php _e(' Dropdown', 'event_espresso') ?>
245 245
 					</label>
246 246
 
@@ -254,25 +254,25 @@  discard block
 block discarded – undo
254 254
 				<td>
255 255
 					<label for="event_list_map_align-none" class="ee-admin-radio-lbl">
256 256
 						<?php $checked = $map_settings->event_list_map_align == 'none' ? 'checked="checked"' : ''; ?>
257
-						<input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked;?>/>
257
+						<input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked; ?>/>
258 258
 						<?php _e(' None', 'event_espresso') ?>
259 259
 					</label>
260 260
 
261 261
 					<label for="event_list_map_align-left" class="ee-admin-radio-lbl">
262 262
 						<?php $checked = $map_settings->event_list_map_align == 'left' ? 'checked="checked"' : ''; ?>
263
-						<input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked;?>/>
263
+						<input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked; ?>/>
264 264
 						<?php _e(' Align Left', 'event_espresso') ?>
265 265
 					</label>
266 266
 
267 267
 					<label for="event_list_map_align-center" class="ee-admin-radio-lbl">
268 268
 						<?php $checked = $map_settings->event_list_map_align == 'center' ? 'checked="checked"' : ''; ?>
269
-						<input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked;?>/>
269
+						<input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked; ?>/>
270 270
 						<?php _e(' Align Center', 'event_espresso') ?>
271 271
 					</label>
272 272
 
273 273
 					<label for="event_list_map_align-right" class="ee-admin-radio-lbl">
274 274
 						<?php $checked = $map_settings->event_list_map_align == 'right' ? 'checked="checked"' : ''; ?>
275
-						<input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked;?>/>
275
+						<input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked; ?>/>
276 276
 						<?php _e(' Align Right', 'event_espresso') ?>
277 277
 					</label>
278 278
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EE_PMT_Paypal_Pro.pm.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Paypal_Pro extends EE_PMT_Base{
28
+class EE_PMT_Paypal_Pro extends EE_PMT_Base {
29 29
 
30 30
 	/**
31 31
 	 * @param EE_Payment_Method $pm_instance
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		require_once($this->file_folder().'EEG_Paypal_Pro.gateway.php');
36 36
 		$this->_gateway = new EEG_Paypal_Pro();
37 37
 		$this->_pretty_name = __("Paypal Pro", 'event_espresso');
38
-		$this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' );
38
+		$this->_default_description = __('Please provide the following billing information.', 'event_espresso');
39 39
 		$this->_requires_https = true;
40 40
 		parent::__construct($pm_instance);
41 41
 	}
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 			'extra_meta_inputs'=>array(
52 52
 //				'paypal_email'=>new EE_Email_Input(), not actually used
53 53
 				'username'=>new EE_Text_Input(array(
54
-					'html_label_text'=>  sprintf(__("Paypal API Username %s", "event_espresso"),$this->get_help_tab_link()),
54
+					'html_label_text'=>  sprintf(__("Paypal API Username %s", "event_espresso"), $this->get_help_tab_link()),
55 55
 					'required' => true
56 56
 				)),
57 57
 				'password'=>new EE_Text_Input(array(
58
-					'html_label_text'=>  sprintf(__("Paypal API Password %s", "event_espresso"),$this->get_help_tab_link()),
58
+					'html_label_text'=>  sprintf(__("Paypal API Password %s", "event_espresso"), $this->get_help_tab_link()),
59 59
 					'required' => true
60 60
 				)),
61 61
 				'signature'=>new EE_Text_Input(array(
62
-					'html_label_text'=>  sprintf(__("Paypal API Signature %s", "event_espresso"),$this->get_help_tab_link()),
62
+					'html_label_text'=>  sprintf(__("Paypal API Signature %s", "event_espresso"), $this->get_help_tab_link()),
63 63
 					'required' => true
64 64
 				)),
65 65
 				'credit_card_types'=>new EE_Checkbox_Multi_Input(
66 66
 						$this->card_types_supported(),
67 67
 						array(
68
-							'html_label_text' => __( 'Card Types Supported', 'event_espresso' ),
68
+							'html_label_text' => __('Card Types Supported', 'event_espresso'),
69 69
 							'required' => true )),
70 70
 				)
71 71
 			)
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	 * @throws \EE_Error
80 80
 	 * @return EE_Billing_Info_Form
81 81
 	 */
82
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
83
-		$allowed_types = $this->_pm_instance->get_extra_meta( 'credit_card_types', TRUE );
82
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
83
+		$allowed_types = $this->_pm_instance->get_extra_meta('credit_card_types', TRUE);
84 84
 		//if allowed types is a string or empty array or null...
85
-		if( empty( $allowed_types )) {
85
+		if (empty($allowed_types)) {
86 86
 			$allowed_types = array();
87 87
 		}
88 88
 
@@ -93,26 +93,26 @@  discard block
 block discarded – undo
93 93
 //				'html_id'=> 'ee-Paypal_Pro-billing-form',
94 94
 				'subsections'=>array(
95 95
 					'credit_card'=>new EE_Credit_Card_Input(
96
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Number', 'event_espresso' ))
96
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Number', 'event_espresso'))
97 97
 					),
98 98
 					'credit_card_type'=>new EE_Select_Input(
99 99
 						//the options are set dynamically
100
-						array_intersect_key( EE_PMT_Paypal_Pro::card_types_supported(), array_flip( $allowed_types )),
101
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Type', 'event_espresso' ))
100
+						array_intersect_key(EE_PMT_Paypal_Pro::card_types_supported(), array_flip($allowed_types)),
101
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Type', 'event_espresso'))
102 102
 					),
103 103
 					'exp_month'=>new EE_Credit_Card_Month_Input(
104
-						TRUE, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' =>  __( 'Expiry Month', 'event_espresso' )  )
104
+						TRUE, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' =>  __('Expiry Month', 'event_espresso'))
105 105
 					),
106 106
 					'exp_year'=>new EE_Credit_Card_Year_Input(
107
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Year', 'event_espresso' )  )
107
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Year', 'event_espresso'))
108 108
 					),
109 109
 					'cvv'=>new EE_CVV_Input(
110
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'CVV', 'event_espresso' ) )
110
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('CVV', 'event_espresso'))
111 111
 					),
112 112
 				)
113 113
 			)
114 114
 		);
115
-		return $this->apply_billing_form_debug_settings( $billing_form );
115
+		return $this->apply_billing_form_debug_settings($billing_form);
116 116
 	}
117 117
 
118 118
 
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 	 * @param \EE_Billing_Info_Form $billing_form
125 125
 	 * @return \EE_Billing_Info_Form
126 126
 	 */
127
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
128
-		if ( $this->_pm_instance->debug_mode() ) {
127
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
128
+		if ($this->_pm_instance->debug_mode()) {
129 129
 			$billing_form->add_subsections(
130
-				array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ),
130
+				array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()),
131 131
 				'credit_card'
132 132
 			);
133 133
 			$billing_form->add_subsections(
134
-				array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php' )),
134
+				array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php')),
135 135
 				'first_name'
136 136
 			);
137
-			$billing_form->get_input( 'credit_card_type' )->set_default( 'Visa' );
138
-			$billing_form->get_input( 'exp_year' )->set_default( 2018);
139
-			$billing_form->get_input( 'cvv' )->set_default( '115' );
137
+			$billing_form->get_input('credit_card_type')->set_default('Visa');
138
+			$billing_form->get_input('exp_year')->set_default(2018);
139
+			$billing_form->get_input('cvv')->set_default('115');
140 140
 		}
141 141
 		return $billing_form;
142 142
 	}
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * Keys are their values, values are their pretty names.
149 149
 	 * @return array
150 150
 	 */
151
-	public static function card_types_supported(){
151
+	public static function card_types_supported() {
152 152
 		return array(
153 153
 			'Visa'=>  __("Visa", 'event_espresso'),
154 154
 			'MasterCard'=>  __("MasterCard", 'event_espresso'),
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * @see EE_PMT_Base::help_tabs_config()
165 165
 	 * @return array
166 166
 	 */
167
-	public function help_tabs_config(){
167
+	public function help_tabs_config() {
168 168
 		return array(
169 169
 			$this->get_help_tab_name() => array(
170 170
 						'title' => __('PayPal Pro Settings', 'event_espresso'),
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * @param EE_Billing_Info_Form $billing_form
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _get_billing_values_from_form( $billing_form ){
183
-		$billing_values = parent::_get_billing_values_from_form( $billing_form );
184
-		$billing_values[ 'country' ] = $billing_form->get_input_value( 'country' );
185
-		$billing_values[ 'credit_card_type' ] = $billing_form->get_input_value( 'credit_card_type' );
182
+	protected function _get_billing_values_from_form($billing_form) {
183
+		$billing_values = parent::_get_billing_values_from_form($billing_form);
184
+		$billing_values['country'] = $billing_form->get_input_value('country');
185
+		$billing_values['credit_card_type'] = $billing_form->get_input_value('credit_card_type');
186 186
 		return $billing_values;
187 187
 	}
188 188
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
Please login to merge, or discard this patch.
core/domain/services/ticket/CancelTicketLineItemService.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use EventEspresso\core\exceptions\EntityNotFoundException;
6 6
 
7 7
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
8
-    exit('No direct script access allowed');
8
+	exit('No direct script access allowed');
9 9
 }
10 10
 
11 11
 
@@ -25,116 +25,116 @@  discard block
 block discarded – undo
25 25
 {
26 26
 
27 27
 
28
-    /**
29
-     * @param \EE_Registration $registration
30
-     * @param int              $quantity
31
-     * @return bool|int
32
-     */
33
-    public function forRegistration(\EE_Registration $registration,$quantity = 1) {
34
-        return $this->cancel(
35
-            $registration->transaction(),
36
-            $registration->ticket(),
37
-            $quantity,
38
-            $registration->ticket_line_item()
39
-        );
40
-    }
28
+	/**
29
+	 * @param \EE_Registration $registration
30
+	 * @param int              $quantity
31
+	 * @return bool|int
32
+	 */
33
+	public function forRegistration(\EE_Registration $registration,$quantity = 1) {
34
+		return $this->cancel(
35
+			$registration->transaction(),
36
+			$registration->ticket(),
37
+			$quantity,
38
+			$registration->ticket_line_item()
39
+		);
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * @param \EE_Transaction $transaction
45
-     * @param \EE_Ticket      $ticket
46
-     * @param int             $quantity
47
-     * @param \EE_Line_Item   $ticket_line_item
48
-     * @return bool|int
49
-     */
50
-    public function cancel(
51
-        \EE_Transaction $transaction,
52
-        \EE_Ticket $ticket,
53
-        $quantity = 1,
54
-        \EE_Line_Item $ticket_line_item = null
55
-    ) {
56
-        $ticket_line_item = $ticket_line_item instanceof \EE_Line_Item
57
-            ? $ticket_line_item
58
-            : $this->getTicketLineItem($transaction, $ticket);
59
-        // first we need to decrement the ticket quantity
60
-        \EEH_Line_Item::decrement_quantity($ticket_line_item, $quantity);
61
-        // no tickets left for this line item ?
62
-        if ((int)$ticket_line_item->quantity() === 0) {
63
-            // then just set this line item as cancelled, save, and get out
64
-            $ticket_line_item->set_type(\EEM_Line_Item::type_cancellation);
65
-            $success = $ticket_line_item->save();
66
-        } else {
67
-            // otherwise create a new cancelled line item, so that we have a record of the cancellation
68
-            $items_subtotal = \EEH_Line_Item::get_pre_tax_subtotal(
69
-                \EEH_Line_Item::get_event_line_item_for_ticket(
70
-                    $transaction->total_line_item(),
71
-                    $ticket
72
-                )
73
-            );
74
-            $cancelled_line_item = \EE_Line_Item::new_instance(
75
-                array(
76
-                    'LIN_name'       => $ticket_line_item->name(),
77
-                    'LIN_desc'       => sprintf(
78
-                        __('%1$s Cancelled: %2$s', 'event_espresso'),
79
-                        $ticket_line_item->desc(),
80
-                        date('Y-m-d h:i a')
81
-                    ),
82
-                    'LIN_unit_price' => (float)$ticket_line_item->unit_price(),
83
-                    'LIN_quantity'   => $quantity,
84
-                    'LIN_percent'    => null,
85
-                    'LIN_is_taxable' => false,
86
-                    'LIN_order'      => $items_subtotal instanceof \EE_Line_Item
87
-                        ? count($items_subtotal->children())
88
-                        : 0,
89
-                    'LIN_total'      => (float)$ticket_line_item->unit_price(),
90
-                    'LIN_type'       => \EEM_Line_Item::type_cancellation
91
-                )
92
-            );
93
-            $success = \EEH_Line_Item::add_item($transaction->total_line_item(), $cancelled_line_item);
94
-        }
95
-        if ( ! $success) {
96
-            throw new \RuntimeException(
97
-                sprintf(
98
-                    __('An error occurred while attempting to cancel ticket line item %1$s', 'event_espresso'),
99
-                    $ticket_line_item->ID()
100
-                )
101
-            );
102
-        }
103
-        return $success;
104
-    }
43
+	/**
44
+	 * @param \EE_Transaction $transaction
45
+	 * @param \EE_Ticket      $ticket
46
+	 * @param int             $quantity
47
+	 * @param \EE_Line_Item   $ticket_line_item
48
+	 * @return bool|int
49
+	 */
50
+	public function cancel(
51
+		\EE_Transaction $transaction,
52
+		\EE_Ticket $ticket,
53
+		$quantity = 1,
54
+		\EE_Line_Item $ticket_line_item = null
55
+	) {
56
+		$ticket_line_item = $ticket_line_item instanceof \EE_Line_Item
57
+			? $ticket_line_item
58
+			: $this->getTicketLineItem($transaction, $ticket);
59
+		// first we need to decrement the ticket quantity
60
+		\EEH_Line_Item::decrement_quantity($ticket_line_item, $quantity);
61
+		// no tickets left for this line item ?
62
+		if ((int)$ticket_line_item->quantity() === 0) {
63
+			// then just set this line item as cancelled, save, and get out
64
+			$ticket_line_item->set_type(\EEM_Line_Item::type_cancellation);
65
+			$success = $ticket_line_item->save();
66
+		} else {
67
+			// otherwise create a new cancelled line item, so that we have a record of the cancellation
68
+			$items_subtotal = \EEH_Line_Item::get_pre_tax_subtotal(
69
+				\EEH_Line_Item::get_event_line_item_for_ticket(
70
+					$transaction->total_line_item(),
71
+					$ticket
72
+				)
73
+			);
74
+			$cancelled_line_item = \EE_Line_Item::new_instance(
75
+				array(
76
+					'LIN_name'       => $ticket_line_item->name(),
77
+					'LIN_desc'       => sprintf(
78
+						__('%1$s Cancelled: %2$s', 'event_espresso'),
79
+						$ticket_line_item->desc(),
80
+						date('Y-m-d h:i a')
81
+					),
82
+					'LIN_unit_price' => (float)$ticket_line_item->unit_price(),
83
+					'LIN_quantity'   => $quantity,
84
+					'LIN_percent'    => null,
85
+					'LIN_is_taxable' => false,
86
+					'LIN_order'      => $items_subtotal instanceof \EE_Line_Item
87
+						? count($items_subtotal->children())
88
+						: 0,
89
+					'LIN_total'      => (float)$ticket_line_item->unit_price(),
90
+					'LIN_type'       => \EEM_Line_Item::type_cancellation
91
+				)
92
+			);
93
+			$success = \EEH_Line_Item::add_item($transaction->total_line_item(), $cancelled_line_item);
94
+		}
95
+		if ( ! $success) {
96
+			throw new \RuntimeException(
97
+				sprintf(
98
+					__('An error occurred while attempting to cancel ticket line item %1$s', 'event_espresso'),
99
+					$ticket_line_item->ID()
100
+				)
101
+			);
102
+		}
103
+		return $success;
104
+	}
105 105
 
106 106
 
107 107
 
108
-    /**
109
-     * @param \EE_Transaction $transaction
110
-     * @param \EE_Ticket      $ticket
111
-     * @return \EE_Line_Item
112
-     * @throws EntityNotFoundException
113
-     * @throws \EE_Error
114
-     */
115
-    protected static function getTicketLineItem(\EE_Transaction $transaction, \EE_Ticket $ticket)
116
-    {
117
-        $line_item = null;
118
-        $ticket_line_items = \EEH_Line_Item::get_line_items_by_object_type_and_IDs(
119
-            $transaction->total_line_item(),
120
-            'Ticket',
121
-            array($ticket->ID())
122
-        );
123
-        foreach ($ticket_line_items as $ticket_line_item) {
124
-            if (
125
-                $ticket_line_item instanceof \EE_Line_Item
126
-                && $ticket_line_item->OBJ_type() === 'Ticket'
127
-                && $ticket_line_item->OBJ_ID() === $ticket->ID()
128
-            ) {
129
-                $line_item = $ticket_line_item;
130
-                break;
131
-            }
132
-        }
133
-        if ( ! ($line_item instanceof \EE_Line_Item && $line_item->OBJ_type() === 'Ticket')) {
134
-            throw new EntityNotFoundException('Line Item Ticket ID', $ticket->ID());
135
-        }
136
-        return $line_item;
137
-    }
108
+	/**
109
+	 * @param \EE_Transaction $transaction
110
+	 * @param \EE_Ticket      $ticket
111
+	 * @return \EE_Line_Item
112
+	 * @throws EntityNotFoundException
113
+	 * @throws \EE_Error
114
+	 */
115
+	protected static function getTicketLineItem(\EE_Transaction $transaction, \EE_Ticket $ticket)
116
+	{
117
+		$line_item = null;
118
+		$ticket_line_items = \EEH_Line_Item::get_line_items_by_object_type_and_IDs(
119
+			$transaction->total_line_item(),
120
+			'Ticket',
121
+			array($ticket->ID())
122
+		);
123
+		foreach ($ticket_line_items as $ticket_line_item) {
124
+			if (
125
+				$ticket_line_item instanceof \EE_Line_Item
126
+				&& $ticket_line_item->OBJ_type() === 'Ticket'
127
+				&& $ticket_line_item->OBJ_ID() === $ticket->ID()
128
+			) {
129
+				$line_item = $ticket_line_item;
130
+				break;
131
+			}
132
+		}
133
+		if ( ! ($line_item instanceof \EE_Line_Item && $line_item->OBJ_type() === 'Ticket')) {
134
+			throw new EntityNotFoundException('Line Item Ticket ID', $ticket->ID());
135
+		}
136
+		return $line_item;
137
+	}
138 138
 
139 139
 
140 140
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param int              $quantity
31 31
      * @return bool|int
32 32
      */
33
-    public function forRegistration(\EE_Registration $registration,$quantity = 1) {
33
+    public function forRegistration(\EE_Registration $registration, $quantity = 1) {
34 34
         return $this->cancel(
35 35
             $registration->transaction(),
36 36
             $registration->ticket(),
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         // first we need to decrement the ticket quantity
60 60
         \EEH_Line_Item::decrement_quantity($ticket_line_item, $quantity);
61 61
         // no tickets left for this line item ?
62
-        if ((int)$ticket_line_item->quantity() === 0) {
62
+        if ((int) $ticket_line_item->quantity() === 0) {
63 63
             // then just set this line item as cancelled, save, and get out
64 64
             $ticket_line_item->set_type(\EEM_Line_Item::type_cancellation);
65 65
             $success = $ticket_line_item->save();
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
                         $ticket_line_item->desc(),
80 80
                         date('Y-m-d h:i a')
81 81
                     ),
82
-                    'LIN_unit_price' => (float)$ticket_line_item->unit_price(),
82
+                    'LIN_unit_price' => (float) $ticket_line_item->unit_price(),
83 83
                     'LIN_quantity'   => $quantity,
84 84
                     'LIN_percent'    => null,
85 85
                     'LIN_is_taxable' => false,
86 86
                     'LIN_order'      => $items_subtotal instanceof \EE_Line_Item
87 87
                         ? count($items_subtotal->children())
88 88
                         : 0,
89
-                    'LIN_total'      => (float)$ticket_line_item->unit_price(),
89
+                    'LIN_total'      => (float) $ticket_line_item->unit_price(),
90 90
                     'LIN_type'       => \EEM_Line_Item::type_cancellation
91 91
                 )
92 92
             );
Please login to merge, or discard this patch.
core/domain/services/registration/CreateRegistrationService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
             $ticket_line_item
93 93
         );
94 94
         $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes();
95
-        return (float)$final_price;
95
+        return (float) $final_price;
96 96
     }
97 97
 
98 98
 
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 use OutOfRangeException;
18 18
 
19 19
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
-    exit('No direct script access allowed');
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -41,54 +41,54 @@  discard block
 block discarded – undo
41 41
 	 * @param EE_Line_Item   $ticket_line_item
42 42
 	 * @param                 $reg_count
43 43
 	 * @param                 $reg_group_size
44
-     * @param string          $reg_status
45
-     * @return EE_Registration
44
+	 * @param string          $reg_status
45
+	 * @return EE_Registration
46 46
 	 * @throws OutOfRangeException
47 47
 	 * @throws EE_Error
48 48
 	 * @throws UnexpectedEntityException
49 49
 	 */
50
-    public function create(
51
-        EE_Event $event,
52
-        EE_Transaction $transaction,
53
-        EE_Ticket $ticket,
54
-        EE_Line_Item $ticket_line_item,
55
-        $reg_count,
56
-        $reg_group_size,
57
-        $reg_status = EEM_Registration::status_id_incomplete
58
-    ) {
59
-        $registrations = $transaction->registrations();
60
-        $reg_count = $reg_count ? $reg_count : count($registrations) + 1;
61
-        $reg_url_link = new RegUrlLink($reg_count, $ticket_line_item);
62
-        $reg_code = new RegCode($reg_url_link, $transaction, $ticket);
63
-        // generate new EE_Registration
64
-        $registration = EE_Registration::new_instance(
65
-            array(
66
-                'EVT_ID'          => $event->ID(),
67
-                'TXN_ID'          => $transaction->ID(),
68
-                'TKT_ID'          => $ticket->ID(),
69
-                'STS_ID'          => $reg_status,
70
-                'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item),
71
-                'REG_session'     => EE_Registry::instance()->SSN->id(),
72
-                'REG_count'       => $reg_count,
73
-                'REG_group_size'  => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations),
74
-                'REG_url_link'    => $reg_url_link,
75
-                'REG_code'        => $reg_code,
76
-            )
77
-        );
78
-        if ( ! $registration instanceof EE_Registration) {
79
-            throw new UnexpectedEntityException($registration, 'EE_Registration');
80
-        }
81
-        // save registration so that we have an ID
82
-        $registration->save();
83
-        // track reservation on reg but don't adjust ticket and datetime reserved counts
84
-        // because that is done as soon as the tickets are added/removed from the cart
85
-        $registration->reserve_ticket();
86
-        $registration->_add_relation_to($event, 'Event', array(), $event->ID());
87
-        $registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID());
88
-        $transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID());
89
-        $registration->save();
90
-        return $registration;
91
-    }
50
+	public function create(
51
+		EE_Event $event,
52
+		EE_Transaction $transaction,
53
+		EE_Ticket $ticket,
54
+		EE_Line_Item $ticket_line_item,
55
+		$reg_count,
56
+		$reg_group_size,
57
+		$reg_status = EEM_Registration::status_id_incomplete
58
+	) {
59
+		$registrations = $transaction->registrations();
60
+		$reg_count = $reg_count ? $reg_count : count($registrations) + 1;
61
+		$reg_url_link = new RegUrlLink($reg_count, $ticket_line_item);
62
+		$reg_code = new RegCode($reg_url_link, $transaction, $ticket);
63
+		// generate new EE_Registration
64
+		$registration = EE_Registration::new_instance(
65
+			array(
66
+				'EVT_ID'          => $event->ID(),
67
+				'TXN_ID'          => $transaction->ID(),
68
+				'TKT_ID'          => $ticket->ID(),
69
+				'STS_ID'          => $reg_status,
70
+				'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item),
71
+				'REG_session'     => EE_Registry::instance()->SSN->id(),
72
+				'REG_count'       => $reg_count,
73
+				'REG_group_size'  => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations),
74
+				'REG_url_link'    => $reg_url_link,
75
+				'REG_code'        => $reg_code,
76
+			)
77
+		);
78
+		if ( ! $registration instanceof EE_Registration) {
79
+			throw new UnexpectedEntityException($registration, 'EE_Registration');
80
+		}
81
+		// save registration so that we have an ID
82
+		$registration->save();
83
+		// track reservation on reg but don't adjust ticket and datetime reserved counts
84
+		// because that is done as soon as the tickets are added/removed from the cart
85
+		$registration->reserve_ticket();
86
+		$registration->_add_relation_to($event, 'Event', array(), $event->ID());
87
+		$registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID());
88
+		$transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID());
89
+		$registration->save();
90
+		return $registration;
91
+	}
92 92
 
93 93
 
94 94
 
@@ -100,40 +100,40 @@  discard block
 block discarded – undo
100 100
 	 * @throws EE_Error
101 101
 	 * @throws OutOfRangeException
102 102
 	 */
103
-    protected function resolveFinalPrice(
104
-        EE_Transaction $transaction,
105
-        EE_Ticket $ticket,
106
-        EE_Line_Item $ticket_line_item
107
-    ) {
108
-        $final_price = EEH_Line_Item::calculate_final_price_for_ticket_line_item(
109
-            $transaction->total_line_item(),
110
-            $ticket_line_item
111
-        );
112
-        $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes();
113
-        return (float)$final_price;
114
-    }
103
+	protected function resolveFinalPrice(
104
+		EE_Transaction $transaction,
105
+		EE_Ticket $ticket,
106
+		EE_Line_Item $ticket_line_item
107
+	) {
108
+		$final_price = EEH_Line_Item::calculate_final_price_for_ticket_line_item(
109
+			$transaction->total_line_item(),
110
+			$ticket_line_item
111
+		);
112
+		$final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes();
113
+		return (float)$final_price;
114
+	}
115 115
 
116 116
 
117 117
 
118
-    /**
119
-     * @param  EE_Registration[] $registrations
120
-     * @param  boolean            $update_existing_registrations
121
-     * @return int
122
-     * @throws EE_Error
123
-     */
124
-    protected function incrementRegCount(array $registrations, $update_existing_registrations = true)
125
-    {
126
-        $new_reg_count = count($registrations) + 1;
127
-        if ($update_existing_registrations) {
128
-            foreach ($registrations as $registration) {
129
-                if ($registration instanceof EE_Registration) {
130
-                    $registration->set_count($new_reg_count);
131
-                    $registration->save();
132
-                }
133
-            }
134
-        }
135
-        return $new_reg_count;
136
-    }
118
+	/**
119
+	 * @param  EE_Registration[] $registrations
120
+	 * @param  boolean            $update_existing_registrations
121
+	 * @return int
122
+	 * @throws EE_Error
123
+	 */
124
+	protected function incrementRegCount(array $registrations, $update_existing_registrations = true)
125
+	{
126
+		$new_reg_count = count($registrations) + 1;
127
+		if ($update_existing_registrations) {
128
+			foreach ($registrations as $registration) {
129
+				if ($registration instanceof EE_Registration) {
130
+					$registration->set_count($new_reg_count);
131
+					$registration->save();
132
+				}
133
+			}
134
+		}
135
+		return $new_reg_count;
136
+	}
137 137
 
138 138
 
139 139
 }
Please login to merge, or discard this patch.